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

Custom data types #68

Merged
merged 5 commits into from
Feb 4, 2025
Merged

Custom data types #68

merged 5 commits into from
Feb 4, 2025

Conversation

wendy-aw
Copy link
Contributor

@wendy-aw wendy-aw commented Feb 4, 2025

  • Modify generate_postgres_schema to return custom data types and their enum labels.
  • Added get_postgres_triggers and get_postgres_functions methods to retrieve custom functions and triggers.

@wendy-aw wendy-aw requested a review from rishsriv February 4, 2025 05:45
Copy link
Member

@rishsriv rishsriv left a comment

Choose a reason for hiding this comment

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

Thank you! Super neat implementation.

Replicated this by creating a copy of our private page_attributes.sql table in my local database.

Then, tested it with the python script below

from defog import Defog

defog = Defog("123", "postgres", db_creds={
  "host": "localhost",
  "port": 5432,
  "user": "postgres",
  "password": "postgres",
  "database": "postgres"
}) # api_key doesn't matter here

defog.generate_db_schema(
  tables=["page_attributes"],
  upload=False,
  scan=False
)

Can confirm that it correct gave us the custom_type_labels back for columns that had ENUM values.

Can also confirm that defog.get_postgres_functions() and defog.get_postgres_triggers() worked as expected.

Will publish this to pypi, update the version to 0.66, and then merge the PR!

@rishsriv rishsriv merged commit 3fd8553 into main Feb 4, 2025
2 checks passed
@rishsriv rishsriv deleted the wendy/custom_types branch February 4, 2025 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants