Skip to content

Support YDB view reflection#111

Merged
vgvoleg merged 1 commit into
mainfrom
issue-110-view-reflection
May 21, 2026
Merged

Support YDB view reflection#111
vgvoleg merged 1 commit into
mainfrom
issue-110-view-reflection

Conversation

@vgvoleg
Copy link
Copy Markdown
Member

@vgvoleg vgvoleg commented May 18, 2026

Summary

  • implement get_view_names() using the DBAPI view listing
  • add get_view_definition() via SHOW CREATE VIEW
  • make get_columns() reflect view columns from SELECT * FROM view LIMIT 0 result metadata
  • cover view reflection with an integration test

Closes #110

@vgvoleg vgvoleg force-pushed the issue-110-view-reflection branch from abe7178 to c29f7f0 Compare May 18, 2026 08:46
@vgvoleg vgvoleg marked this pull request as ready for review May 18, 2026 08:47
Comment thread ydb_sqlalchemy/sqlalchemy/__init__.py Outdated
Comment on lines +266 to +267
if schema:
raise ydb_dbapi.NotSupportedError("unsupported on non empty schema")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking): Move this to a private helper method, and call in all methods.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

Comment thread test/test_inspect.py
Comment on lines +71 to +76
finally:
try:
cursor.execute_scheme(f"DROP VIEW `{view_name}`")
except Exception:
pass
cursor.close()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking): Move Try and Except part with creation of the view to a yield fixture.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

type_name = type_name[:-1]

decimal_match = DECIMAL_DBAPI_TYPE_RE.match(type_name)
if decimal_match:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: What about Array and other container types? They could be in View columns, don't they?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the problem is same for tables, let's fix this outside of this pr

@vgvoleg vgvoleg force-pushed the issue-110-view-reflection branch from c29f7f0 to c567a79 Compare May 21, 2026 09:23
@vgvoleg vgvoleg merged commit 2a64296 into main May 21, 2026
6 checks passed
@vgvoleg vgvoleg deleted the issue-110-view-reflection branch May 21, 2026 09:30
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.

Implement get_view_names(), get_view_definition() and fix get_columns() for views

2 participants