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

Foreign Key processing updates #55

Merged
merged 2 commits into from
Jan 12, 2024

Conversation

cfhowes
Copy link
Contributor

@cfhowes cfhowes commented Jan 11, 2024

I was having some problems with how FOREIGN KEYs were being handled for both keys listed after the COLUMN statements (rather then inline in the statement) and for those with compound keys.

If thinks look reasonable, I'll update the changelog as well.

@@ -21,9 +22,11 @@ def get_tables_information(
"contains ddl or ddl_file that contains path to ddl file to parse"
)
if ddl:
tables = DDLParser(ddl).run(group_by_type=True)
tables = DDLParser(ddl, normalize_names=True).run(group_by_type=True)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this feels like a good change to me - i think i would want my output code to have normalized names. I was having problems with my foreign keys until i put this setting in, but i'll figure out where that went wrong if you don't like this change.

@@ -24,7 +24,7 @@ classifiers = [

[tool.poetry.dependencies]
python = ">=3.7,<4.0"
simple-ddl-parser = "^0.28"
simple-ddl-parser = "^1.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i hope this is OK. All the changes i submitted to simple-ddl-parser were to make this work for my DDL. ;)

@@ -50,7 +49,7 @@ class UsersWorkSchedule(db.Model):

__tablename__ = 'users_WorkSchedule'

id = db.Column(ARRAY((1,1)), primary_key=True)
id = db.Column(db.Integer(), primary_key=True)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

looking at the code above, I think this was actually a bug in the test/parsing from before. with the updated simple-ddl-parser version the parsing bug has been fixed and so the test updated. please let me know if i interpreted that incorrectly.

@xnuinside
Copy link
Owner

@cfhowes thanks for opening the PR, I will check little bit later

@xnuinside xnuinside merged commit 6523ae7 into xnuinside:main Jan 12, 2024
7 checks passed
@xnuinside
Copy link
Owner

xnuinside commented Jan 12, 2024

@cfhowes released in version 0.15.1, thank you one more time!

@cfhowes cfhowes deleted the fk_processing_updates branch January 13, 2024 17:10
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.

None yet

2 participants