Write insertInto | teradatamlspk | pyspark2teradataml - Write insertInto - Teradata Package for Python

Teradata® pyspark2teradataml User Guide

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Package for Python
Release Number
20.00
Published
December 2024
ft:locale
en-US
ft:lastEdition
2024-12-18
dita:mapPath
oeg1710443196055.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
oeg1710443196055
Product Category
Teradata Vantage

insertInto provides capability of changing the type of column while saving the table.

Example

>>> df
DataFrame[id: int, masters: str, gpa: float, stats: str, programming: str, admitted: int]
>>> from teradatasqlalchemy import VARCHAR
>>> from teradatasqlalchemy import INTEGER
>>> df.write.options(types = {'admitted': VARCHAR, 'gpa':INTEGER}).insertInto("new_table", overwrite = True)
>>> df1 = teraspark_session.createDataFrame("new_table")
>>> df1
DataFrame[id: int, masters: str, gpa: int, stats: str, programming: str, admitted: str]