Also: how can I keep sql code in .sql files and re...
# integration-snowflake
c
Also: how can I keep sql code in .sql files and read it into assets? It's much easier to use VSCode (or whatever editor) syntax highlighting on the SQL when it's in a .sql file than when it is embedded as a string in a python file.
f
Hello @clay, A way to do it would be:
Copy code
@asset
def my_asset(context):
    path = "path/to/your_query.sql"
    with open(path, 'r') as f:
        query = f.read()
    <http://context.log.info|context.log.info>(query)
    ...
If you have a lot of queries and dependencies between them, you should consider using dbt and dagster-dbt
c
That actually didn't work for me, for some reason. I had to use
sql_file = file_relative_path(__file__, filename)
👍 1