dbt-labs / dbt-external-tables

dbt macros to stage external sources
https://hub.getdbt.com/dbt-labs/dbt_external_tables/latest/
Apache License 2.0
294 stars 119 forks source link

Snowflake: `ALTER ... REFRESH` can only be triggered on partitioned tables #202

Closed WesleyBatista closed 7 months ago

WesleyBatista commented 1 year ago

Describe the bug

If one wants to trigger alter external table my_table refresh; on a Delta table that is not partitioned it's not possible because current implementation checks for external.partitions setting and if external.auto_refresh is false - ref.

Steps to reproduce

Example source.yml to consider:

version: 2

sources:
  - name: my_source
    database: my_database
    schema: my_schema

    tables:
      - name: my_table
        description: "my table"
        external:
          location: "@my_schema.my_stage/my_path/"
          file_format: "( type = parquet )"
          table_format: delta
          auto_refresh: false
          refresh_on_create: false
        columns:
          - name: col1
            data_type: varchar
          - name: col2
            data_type: varchar

then try to trigger a refresh:

dbt run-operation stage_external_sources --vars "ext_full_refresh: true"

Expected results

We should be able to trigger ALTER EXTERNAL TABLE ... REFRESH on non-partitioned Delta tables.

Actual results

Screenshots and log output

System information

The contents of your packages.yml file:

packages:
  - package: dbt-labs/dbt_utils
    version: 0.9.6
  - package: dbt-labs/codegen
    version: 0.8.0
  - package: calogica/dbt_expectations
    version: [">=0.8.0", "<0.9.0"]
  - package: elementary-data/elementary
    version: 0.7.4
  - git: https://github.com/WesleyBatista/dbt-external-tables
    revision: 028a2d733e9735e191d480f1bdbed4bbed84a50d

Which database are you using dbt with?

The output of dbt --version:

1.3

The operating system you're using:

The output of python --version:

Additional context

Using branch from #199 on DBT Cloud

github-actions[bot] commented 7 months ago

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

github-actions[bot] commented 7 months ago

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.