A metadata representation of an existing or to-be-created database table within the Astro ecosystem.

View on GitHub

Last Updated: Dec. 16, 2021

Access Instructions

Install the Astro provider package into your Airflow environment.

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


table_namestrName of the table to be created or referenced.
conn_idstrThe ID of the configured Airflow Connection to use to connect to a database.
databaseOptional[str]The name of the database to use when executing the SQL.
schemaOptional[str]The name of the schema to use when executing the SQL.
warehouseOptional[str]The name of the warehouse to use when executing the SQL.


To instantiate a table or bring in a table from a database into the Astro ecosystem, you can pass a Table object into the class. This Table object will contain all necessary metadata to handle table creation between tasks. Once you define it in the beginning of your pipeline, astro can automatically pass that metadata along.

from astro.sql import transform
from astro.sql.table import Table
def my_first_sql_transformation(input_table: Table):
return "SELECT * FROM {input_table}"
def my_second_sql_transformation(input_table_2: Table):
return "SELECT * FROM {input_table_2}"
with dag:
my_table = my_first_sql_transformation(
input_table=Table(table_name="foo", database="bar", conn_id="postgres_conn")

Was this page helpful?