Skip to content
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

Feature request: generate sources "update" mode also update staging models (rather than overwrite or leave unchanged) #342

Open
jaredx435k2d0 opened this issue Mar 7, 2023 · 2 comments
Labels
enhancement New feature or request reviewed: yes Has undergone review triaged: no Hasn't been approved for future implementation

Comments

@jaredx435k2d0
Copy link

jaredx435k2d0 commented Mar 7, 2023

Describe the current behavior
If I have a pre-existing some_staging_model.sql as:

SELECT
	col1

FROM
	some_table

WHERE
	col1 = FALSE

, and there is a new column that should be added due to it's being recently-added in the source, generate sources will remove my existing transformations when it updates some_staging_model.sql as:

SELECT
	col1
,	col2

FROM
	some_table

Requested behaviour
I would expect that it would retain the existing SQL, and just add new columns / drop newly-deleted columns

Desktop (please complete the following information):

  • OS: macOS 13.2.1 (22D68)
  • Python 3.10.10
  • dbt-core==1.3.3
  • dbt-coves==1.3.0a29
  • dbt-snowflake==1.3.0

Additional context
Contents of my .dbt_coves.config.yml:

generate:
  sources:
    update_strategy: update

Maybe this should only be the case if the update strategy is set to "update"?

I'm trying to automate my staging layer refresh using dbt-coves. If, however, I'll lose all staging layer transformations every time it's run, then I can't use it for this purpose.

@jaredx435k2d0 jaredx435k2d0 added the bug Something isn't working label Mar 7, 2023
@github-actions github-actions bot added the triaged: no Hasn't been approved for future implementation label Mar 7, 2023
@BAntonellini
Copy link
Collaborator

@jaredx435k2d0 --update-strategy, as you can read in the docs in README.md, defines the action to perform on property files (yaml):

--update-strategy
# Action to perform when a property file already exists: 'update', 'recreate', 'fail', 'ask' (per file)

About SQL, when a staging model .sql file exists, the program asks you whether want to overwrite it or leave it as is.

@jaredx435k2d0 jaredx435k2d0 changed the title [BUG] (/ question) generate sources is dropping existing transformations from staging models in update mode Feature request: generate sources "update" mode also update staging models (rather than overwrite or leave unchanged) Mar 13, 2023
@jaredx435k2d0
Copy link
Author

@BAntonellini got it.

I just changed this to be a feature request to also update SQL files.

@ssassi ssassi added enhancement New feature or request and removed bug Something isn't working labels Mar 16, 2023
@BAntonellini BAntonellini added the reviewed: yes Has undergone review label Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request reviewed: yes Has undergone review triaged: no Hasn't been approved for future implementation
Projects
None yet
Development

No branches or pull requests

3 participants