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

Extract metadata from the query into the statement. #36

Merged
merged 4 commits into from
Jun 11, 2024

Conversation

surister
Copy link
Collaborator

@surister surister commented Jun 11, 2024

Summary of the changes / Why this is an improvement

Implements extracting metadata using an AstBuilder to enrich a Statement

Currently only gets the schema and table name.

Example:

stmt = sqlparse("SELECT A, B FROM doc.tbl1")[0]

print(stmt.metadata)
# Metadata(schema='doc', table_name='tbl1')

Sets the foundation for more features in the future, like #31 .

Checklist

  • Link to issue this PR refers to (if applicable):
  • CLA is signed

@surister surister requested review from amotl and matriv June 11, 2024 13:51
Copy link

@matriv matriv left a comment

Choose a reason for hiding this comment

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

nice! LGTM

@surister surister force-pushed the extract_metadata branch 2 times, most recently from 87e1609 to c5fe54d Compare June 11, 2024 14:35
Copy link
Member

@amotl amotl left a comment

Choose a reason for hiding this comment

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

Thanks. Just suggested two wording nits.

cratedb_sqlparse_py/cratedb_sqlparse/AstBuilder.py Outdated Show resolved Hide resolved
cratedb_sqlparse_py/cratedb_sqlparse/AstBuilder.py Outdated Show resolved Hide resolved
Copy link
Member

@amotl amotl left a comment

Choose a reason for hiding this comment

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

Another suggestion which might be helpful.

cratedb_sqlparse_py/tests/test_enricher.py Outdated Show resolved Hide resolved
@surister surister force-pushed the extract_metadata branch 3 times, most recently from a7d6854 to fb2ebcd Compare June 11, 2024 16:13
@surister surister merged commit 78d703d into crate:main Jun 11, 2024
7 checks passed
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