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

Schema compare between environments & generate change script #99

Closed
jp-vanheerden opened this issue Jul 25, 2024 · 4 comments
Closed

Schema compare between environments & generate change script #99

jp-vanheerden opened this issue Jul 25, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jp-vanheerden
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When promoting between environments (eg Dev and UAT), tables may be different or not exist in the second environment. The process of updating the tables is currently manual and it would be useful to have a process that compares the table definitions between two environments and generates a script to change the second environment to match the first environment.

Describe the solution you'd like
Process that:

  1. Gets the table definitions for the first environment
  2. Gets the table definitions for the second environment
  3. Compares the table definitions and generates DDL statements to handle changes
  4. Where changes cannot be handled automatically, a placeholder is added
  5. Generate a notebook that can be run in the second environment

Describe alternatives you've considered
There may be utilities available in the community that can be re-used

Additional context
N/A

@jp-vanheerden jp-vanheerden added the enhancement New feature or request label Jul 25, 2024
@grantkriegerai grantkriegerai added this to the V0.5.0 milestone Aug 5, 2024
@avinvagel
Copy link
Contributor

avinvagel commented Aug 8, 2024

Two new notebooks added to: dbt\include\fabricsparknb\notebooks:

  1. compare_notebook this file gets generated by the compare() command
  2. util_BuildMetadata this file has been added to the pre_dbt upload function

Two new commands added:

  1. buildcomparemetadata: which will execute the util_buildmetadata notebook in the environment configured. This notebook will create a comparemetadata table in their respective environment that will store the Lakehouse schema information.
    Arguments:
  • dbt_project_dir: The path to the dbt_project directory. If left blank it will use the current directory
  • source: Source environment name from profile.yml
  • target: Target environment name from profile.yml
  • dbt_profiles_dir: The path to the dbt_profile directory. If left blank it will use the users home directory followed by .dbt.
  1. compare: This command will compare two environments Lakehouse's. Generated notebooks will be uploaded to the 'target' environment configured in the 'profile.yml' file which will contain the sql commands that can be used to create and alter tables, from one environment to the next.
  • dbt_project_dir: The path to the dbt_project directory. If left blank it will use the current directory
  • source: Source environment name from profile.yml
  • target: Target environment name from profile.yml
  • dbt_profiles_dir: The path to the dbt_profile directory. If left blank it will use the users home directory followed by .dbt.

@avinvagel
Copy link
Contributor

New items required in the profile.yml file to specify the other environments to compare to:

image

@grantkriegerai
Copy link
Contributor

Review session setup for tuesday with 13th August to confirm all happy

@annstephyjose
Copy link
Contributor

Created #185 and #186 to address the further enhancements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants