astro-sdk icon indicating copy to clipboard operation
astro-sdk copied to clipboard

Transform op - database is not picked from metadata

Open utkarsharma2 opened this issue 3 years ago • 0 comments
trafficstars

Describe the bug

with DAG(dag_id="test", schedule=None, start_date=datetime(1970, 1, 1)) as dag:
    @aql.transform
    def select(input_table: Table):
        return "SELECT * FROM my_db.my_schema.my_table LIMIT 4;"  # {{ input_table }} was also failing
    select(
        input_table=Table(metadata={"schema": "my_schema", "database": "db"}, name="my_table", conn_id="my_conn_id"),
        output_table=Table(name="fritz_test_1234")
    )

snowflake.connector.errors.ProgrammingError: 090105 (22000): 01a77af0-0605-96b0-0000-682112f6e8ae: Cannot perform SELECT. This session does not have a current database. Call 'USE DATABASE', or use a qualified name. ref: https://astronomer.slack.com/archives/C02B8SPT93K/p1665414029917169

Version

  • Astro: 1.1.1

To Reproduce Try the above code.

Expected behavior If the DB is not specified in the connection we should be able to pick from metadata.

utkarsharma2 avatar Oct 10 '22 15:10 utkarsharma2