export_file

Astro SDKCertified

Convert ExportFileOperator into a function. Returns XComArg.

View on GitHub

Last Updated: Aug. 18, 2022

Access Instructions

Install the Astro SDK provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.

Parameters

input_dataRequiredastro.sql.table.Table | pandas.DataFrameInput table / dataframe
output_fileRequiredastro.files.base.FilePath and conn_id
if_existsLiteral['replace', 'exception']Overwrite file if exists. Default 'exception'
task_idstrtask id, optional

Documentation

Returns an XComArg object of type File which matches the output_file parameter. This will allow users to perform further actions with the exported file.

Example:
with sample_dag:
table = aql.load_file(input_file=File(path=data_path), output_table=test_table)
exported_file = aql.export_file(
input_data=table,
output_file=File(path="/tmp/saved_df.csv"),
if_exists="replace",
)
res_df = aql.load_file(input_file=exported_file)

Was this page helpful?