Skip to main content

CSVtoRawOperator

This operator takes a CSV and puts it into a target table in the database. Creates a new table if the table does not exist. It can be found at v12-data-migration-utility/src/utilities/operators/raw_operator.py. Example implementations of this operator can be found in the import_and_transform dags for fullcare and samplecare.

Arguments

csv_name (str): the name of the CSV that will be imported into the databse. should include the full path and the .csv extension. Ex: /data/Accounts.csv

target_table (str): the name of the target schema + table that the CSV data will be loaded into. Ex: transform.account

db_uri(str): The uri of the target database

append(boolean): a flag that determines whether to append or truncate the data to the target table if it already exists. If true, it appends the data to the existing table. If false, it truncates (replaces) the existing data

Assumes

Assumes that the schema passed in via target_table already exists, and that csv_name is the path to a valid .csv file

Returns

Returns an Airflow Operator

Raises

Raises an exception if any of the above arguments evaluate to None