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

fix: add mutator to get_columns_description #29885

Merged
merged 1 commit into from
Aug 9, 2024

Conversation

eschutho
Copy link
Member

@eschutho eschutho commented Aug 8, 2024

SUMMARY

Aiming to have the mutator run on every analytical db request, I'm adding it to the get_columns_description which is used when creating a virtual dataset and looking up which columns should be added to the dataset.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

update the SQL_QUERY_MUTATOR. As a test, I edited mine to look like this:

def mutator(sql: str, database: Any, **kwargs: Any) -> str:

    key = "foo"
    output = f"-- {key}\n"

    return output + f"select color from bart_lines\n-- {key}"


SQL_QUERY_MUTATOR = mutator

with the mutator:
Screenshot 2024-08-08 at 3 35 18 PM
Screenshot 2024-08-08 at 3 35 12 PM

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@dosubot dosubot bot added data Namespace | Anything related to data, including databases configurations, datasets, etc. data:dataset Related to dataset configurations labels Aug 8, 2024
@eschutho eschutho marked this pull request as draft August 8, 2024 00:49
@eschutho eschutho force-pushed the elizabeth/add-mutator-dataset branch from 7734db3 to 06bdca7 Compare August 8, 2024 22:34
@pull-request-size pull-request-size bot added size/L and removed size/XS labels Aug 8, 2024
@eschutho eschutho marked this pull request as ready for review August 8, 2024 22:34
@dosubot dosubot bot added the change:backend Requires changing the backend label Aug 8, 2024
@@ -68,6 +68,24 @@ def create_test_table_context(database: Database):
engine.execute(f"DROP TABLE {full_table_name}")


@contextmanager
def create_and_cleanup_table(table=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@eschutho eschutho merged commit 38d64e8 into master Aug 9, 2024
37 of 61 checks passed
@rusackas rusackas deleted the elizabeth/add-mutator-dataset branch August 9, 2024 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:backend Requires changing the backend data:dataset Related to dataset configurations data Namespace | Anything related to data, including databases configurations, datasets, etc. preset-io review:draft size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants