-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't invoke list_relations_without_caching from a macro #390
Comments
I'm new here. Will #391 fix it? |
@voroninman can you copy here the macro that you are trying to use? yes #391 should make the method |
Thanks for a quick reply! Below is the macro that I'm currently working on. {% macro drop_created_playground_schemas() %}
{% if "playground" not in target.schema %}
{{ exceptions.raise_compiler_error("Should never be run outside a playground target.") }}
{% endif %}
{% set query_affected_schemas %}
SELECT DISTINCT schema_name
FROM awsdatacatalog.information_schema.schemata
WHERE schema_name LIKE '{{ target.schema }}%'
{% endset %}
{% set result = run_query(query_affected_schemas) %}
{% for row in result %}
{% set schema_name = row.get('schema_name') %}
{% set schema_relation = api.Relation.create(database=target.database, schema=schema_name) %}
-- We drop relations to make sure we actually delete all s3 objects related to the schema
{% do log('Dropping relations in schema: ' ~ schema_relation, info=True) %}
{% set relations = adapter.list_relations_without_caching(schema_relation) %}
{% for relation in relations %}
{% do log('\tDropping: ' ~ relation.get('name'), info=True) %}
{% do dbt.drop_relation(adapter.get_relation(
database=relation.get('database'),
schema=relation.get('schema'),
identifier=relation.get('name'),
)) %}
{% endfor %}
{% do log('Dropping schema: ' ~ schema_relation, info=True) %}
{% do drop_schema(schema_relation) %}
{% endfor %}
{% endmacro %} |
Thanks, I merged your PR, you can try to install the latest version of the adapter from main and see if it works. |
Already did. It works as expected. Thanks a lot! Fixed by #391. |
{{ adapter.list_relations_without_caching(schema_relation) }}
fails with'dbt.context.providers.RuntimeDatabaseWrapper object' has no attribute 'list_relations_without_caching'
.The text was updated successfully, but these errors were encountered: