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

[sqlalchemy] Add table and column comment support #329

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 <cbornet@hotmail.com>
Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
Co-authored-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
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 <jesse.whitehouse@databricks.com>
* Add support for table comments

Signed-off-by: Christophe Bornet <cbornet@hotmail.com>

* Use per-table DTE to get the table comments

Signed-off-by: Christophe Bornet <cbornet@hotmail.com>

* Revert pytest.ini change

Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>

* 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 <jesse.whitehouse@databricks.com>

* Add unit tests for table comments

Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>

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

Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>

* Stop skipping table comment portions of ComponentReflectionTest

Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>

* Move DTE parsing into _parse.py

Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>

* Add e2e test using inspector

Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>

* Add unit test for new method in _parse.py

Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>

* Fix assertion in column comment test

This was missed in #328

Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>

---------

Signed-off-by: Christophe Bornet <cbornet@hotmail.com>
Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
Co-authored-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
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 👍 !

Signed-off-by: Jesse Whitehouse <jesse.whitehouse@databricks.com>
@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
11 of 12 checks passed
@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