Skip to content

fixes mapping views - #5

Closed
lv10 wants to merge 14 commits into
startappdev:masterfrom
lv10:master
Closed

fixes mapping views#5
lv10 wants to merge 14 commits into
startappdev:masterfrom
lv10:master

Conversation

@lv10

@lv10 lv10 commented Dec 6, 2017

Copy link
Copy Markdown

Problem:
SQLAlchemy-Vertica was able to see view names but I wasn't able to query data from views. The view (aka table id) was only obtained for tables not views.
Solution:
Add a union statement so that views can be obtained and queried.

@lv10

lv10 commented Feb 7, 2018

Copy link
Copy Markdown
Author

Is there anything I can do to help you guys implement this minor fix?

lv10 and others added 13 commits September 28, 2018 10:56
Add missing dtypes and method for reflection
Version bump - support added for geometry.
modify column reflection to return complete type info
- Migrate dialect architecture to SQLAlchemy 2.0+ DefaultDialect with query caching (supports_statement_cache = True)
- Add non-blocking asynchronous dialect (vertica+vertica_python_async://) supporting create_async_engine and AsyncSession
- Add native Alembic migration plugin (VerticaImpl) with transactional DDL and index no-op handling
- Add complete Vertica data types (GEOMETRY, GEOGRAPHY, UUID, LONG VARCHAR, LONG VARBINARY, ARRAY, MAP, ROW, TIMESTAMPTZ, TIMETZ, INTERVAL)
- Add complete parameterized reflection for tables, views, primary keys, foreign keys, unique/check constraints, comments, and schemas
- Modernize packaging to PEP 517/621 with pyproject.toml and driver extras
- Drop six and Python 2 legacy code in favor of modern Python 3.9-3.14+ typing
- Add comprehensive unit test suite with 95% pytest test coverage
…ation

Upgrade to SQLAlchemy 2.0+, Async Engine, and Alembic Support
@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown

Greptile Summary

The PR substantially modernizes the dialect for SQLAlchemy 2.x while extending reflection so views can resolve table IDs and columns.

  • Replaces the PostgreSQL-derived implementation with Vertica-specific SQL, DDL, type, and reflection compilers.
  • Adds synchronous and asynchronous vertica-python support, PyODBC and turbodbc dialects, and Alembic integration.
  • Moves package metadata to pyproject.toml and significantly expands tests and documentation.
  • The async cleanup adapter currently hides failures from the underlying driver.

Confidence Score: 4/5

The PR appears safe to merge, with a non-blocking cleanup issue where the async adapter hides cursor and connection close failures.

The view-aware reflection changes have no established blocking defect, but unconditional exception suppression during async cleanup can conceal failed resource release and make connection leaks difficult to detect.

Files Needing Attention: sqlalchemy_vertica/dialect_vertica_python_async.py

Important Files Changed

Filename Overview
sqlalchemy_vertica/base.py Replaces the core dialect, compiler, and reflection implementation and adds view-aware object-ID and column reflection.
sqlalchemy_vertica/dialect_vertica_python_async.py Adds a thread-offloaded async DBAPI adapter, but suppresses all cursor and connection close failures.
pyproject.toml Introduces modern package metadata, driver extras, dialect entry points, and test configuration.
tests/test_reflection.py Expands reflection coverage, although view-column and view-existence paths are not directly exercised.
sqlalchemy_vertica/alembic.py Adds Vertica Alembic registration, type synonyms, and intentional index-operation no-ops.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  SA[SQLAlchemy reflection] --> OID[get_table_oid]
  OID --> T[v_catalog.tables]
  OID --> V[v_catalog.views]
  SA --> C[get_columns]
  C --> TC[v_catalog.columns]
  C --> VC[v_catalog.view_columns]
  SA --> D[Driver dialect]
  D --> VP[vertica-python]
  D --> PY[PyODBC]
  D --> TU[turbodbc]
  D --> AS[Async adapter]
  AS --> TH[Thread-offloaded vertica-python calls]
Loading
Prompt To Fix All With AI
### Issue 1
sqlalchemy_vertica/dialect_vertica_python_async.py:63-67
**Close failures are silently discarded**

When the Vertica driver raises while closing an async cursor or connection, these adapters discard the exception and report successful cleanup, hiding resource leaks and preventing the pool from recognizing an unusable connection. The connection adapter repeats this behavior at lines 95–99.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Merge pull request #6 from lv10/feature/..." | Re-trigger Greptile

Comment on lines +63 to +67
async def close(self) -> None:
try:
await asyncio.to_thread(self._sync_cursor.close)
except Exception:
pass

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Close failures are silently discarded

When the Vertica driver raises while closing an async cursor or connection, these adapters discard the exception and report successful cleanup, hiding resource leaks and preventing the pool from recognizing an unusable connection. The connection adapter repeats this behavior at lines 95–99.

Prompt To Fix With AI
This is a comment left during a code review.
Path: sqlalchemy_vertica/dialect_vertica_python_async.py
Line: 63-67

Comment:
**Close failures are silently discarded**

When the Vertica driver raises while closing an async cursor or connection, these adapters discard the exception and report successful cleanup, hiding resource leaks and preventing the pool from recognizing an unusable connection. The connection adapter repeats this behavior at lines 95–99.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

@lv10
lv10 deleted the branch startappdev:master August 24, 2026 00:58
@lv10 lv10 closed this Aug 24, 2026
@lv10
lv10 deleted the master branch August 24, 2026 00: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.

1 participant