Skip to content

[sqlalchemy] Add table and column comment support #329

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

Merged
merged 5 commits into from
Jan 25, 2024
Merged

Conversation

susodapop
Copy link
Contributor

Description

This PR consolidates the changes from #306 and #308 after review + tests + refactor which I placed into a staging branch to coordinate reviews and testing.

cbornet and others added 3 commits January 23, 2024 15:30
---------

Signed-off-by: Christophe Bornet <[email protected]>
Signed-off-by: Jesse Whitehouse <[email protected]>
Co-authored-by: Jesse Whitehouse <[email protected]>
Fix: this allows component reflection test to pass

Databricks returns an empty string in the REMARKS column rather than a
`NoneType`.

Signed-off-by: Jesse Whitehouse <[email protected]>
* Add support for table comments

Signed-off-by: Christophe Bornet <[email protected]>

* Use per-table DTE to get the table comments

Signed-off-by: Christophe Bornet <[email protected]>

* Revert pytest.ini change

Signed-off-by: Jesse Whitehouse <[email protected]>

* Fix typo in test name for columns. Move .engine and .compile into a base
class. Scaffold in the Table Comment unit tests.

Signed-off-by: Jesse Whitehouse <[email protected]>

* Add unit tests for table comments

Signed-off-by: Jesse Whitehouse <[email protected]>

* Revert overrides since these aren't needed after #328

Signed-off-by: Jesse Whitehouse <[email protected]>

* Stop skipping table comment portions of ComponentReflectionTest

Signed-off-by: Jesse Whitehouse <[email protected]>

* Move DTE parsing into _parse.py

Signed-off-by: Jesse Whitehouse <[email protected]>

* Add e2e test using inspector

Signed-off-by: Jesse Whitehouse <[email protected]>

* Add unit test for new method in _parse.py

Signed-off-by: Jesse Whitehouse <[email protected]>

* Fix assertion in column comment test

This was missed in #328

Signed-off-by: Jesse Whitehouse <[email protected]>

---------

Signed-off-by: Christophe Bornet <[email protected]>
Signed-off-by: Jesse Whitehouse <[email protected]>
Co-authored-by: Jesse Whitehouse <[email protected]>
Signed-off-by: Jesse Whitehouse <[email protected]>
Copy link

@cbornet cbornet left a comment

Choose a reason for hiding this comment

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

LGTM


comment = inspector.get_table_comment(tbl_name)

assert comment == {"text": "table comment"}
Copy link

Choose a reason for hiding this comment

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

Could also check column comments with inspector.get_columns ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you already did this with the test_column_comments, no? I can rewrite it to use the same fixtures and be more efficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

woof, haven't had my coffee yet. i understand your comment now. I've added an extra method to this test class that simply checks for reflection of the column comment. thank you!

Copy link

Choose a reason for hiding this comment

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

Awesome 👍 !

@databricks databricks deleted a comment from github-actions bot Jan 24, 2024
@databricks databricks deleted a comment from github-actions bot Jan 24, 2024
Copy link

Thanks for your contribution! To satisfy the DCO policy in our contributing guide every commit message must include a sign-off message. One or more of your commits is missing this message. You can reword previous commit messages with an interactive rebase (git rebase -i main).

@susodapop susodapop merged commit 7ecddea into main Jan 25, 2024
@susodapop susodapop deleted the sqlalchemy-staging branch January 25, 2024 20:58
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.

3 participants