informatica.infacore.dataframe.dataobject.DataObject.write

DataObject.write(i_df: DataFrame, options: dict = None)

Action method which takes the INFACore DataFrame and writes data to the data source.

Parameters:
  • i_df (DataFrame) – INFACore DataFrame object.

  • options (dict, optional) –

    A placeholder to specify properties for advanced functionalities. Default is None.

    options[“data_format”], optional : dict, must have the “format” attribute. Allowed values for “format” are ‘Avro’, ‘Parquet’, ‘Orc’, ‘Json’, and ‘Flat’.

    options[“create_target”], optional : bool, specify value as True to create a new target object with schema similar to the source object.

    options[“operation_type”], optional : str, type of operation. Allowed value is ‘Insert’.

Returns:

Returns the detailed statistics for the write operation, such as the number of rows written to the target data source.

Return type:

Stats

Examples

# Example 1 - Write data from a Customers table in Oracle to an existing Snowflake table

>>> import informatica.infacore as ic
>>> orcl_do = ic.get_datasource("Oracle").get_connection("Oracle Prod").get_data_object("Customers")
>>> snow_do = ic.get_datasource("Snowflake").get_connection("Snowflake US").get_data_object("Prod/Sales/Customers")
>>> i_df = orcl_do.read()
>>> stats = snow_do.write(i_df)

# Example 2 - Write Employee data from Oracle to a new table in Snowflake

>>> import informatica.infacore as ic
>>> orcl_do = ic.get_datasource("Oracle").get_connection("Oracle Prod").get_data_object("Employee")
>>> snow_do = ic.get_datasource("Snowflake").get_connection("Snowflake US").get_data_object("Prod/Sales/Employee")
>>> i_df = orcl_do.read()
>>> options = {
        "create_target" : True
    }
>>> stats = snow_do.write(i_df, options)