Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
=========

4.6.0
-----

Features
~~~~~~~~

- Fixed import issue with SQLAlchemy 2.1 preview
- Fixed an issue causing ``with_for_update`` to fail if ``of`` was not a column list

4.5.0
-----

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ maintainers = [
name = "sqlalchemy-hana"
readme = "README.rst"
requires-python = "~=3.10"
version = "4.5.0"
version = "4.6.0"

[project.optional-dependencies]
alembic = ["alembic~=1.12"]
Expand Down
19 changes: 16 additions & 3 deletions sqlalchemy_hana/dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,15 @@
if sqlalchemy.__version__ < "2.1":
from sqlalchemy.sql.ddl import _DropView as BaseDropView
else:
# In SQLAlchemy 2.1, the _DropView class was renamed to DropView.
# Also CreateView was added
# isort moves the comments around leading to issues
# isort: off
# In SQLAlchemy 2.1, the _DropView class was renamed to DropView.
# pylint:disable-next=no-name-in-module
from sqlalchemy.sql.ddl import ( # type: ignore[attr-defined]
CreateView as BaseCreateView,
)

# pylint:disable-next=no-name-in-module
from sqlalchemy.sql.ddl import ( # type: ignore[attr-defined,no-redef]
DropView as BaseDropView,
Expand Down Expand Up @@ -459,6 +465,11 @@ def visit_unique_constraint(
text += self.define_constraint_deferrability(constraint)
return text

def visit_create_table_as(self, element: Any, **kw: Any) -> str:
result = super().visit_create_table_as(element, **kw) # type: ignore[misc]
prefix, sep, select_sql = result.partition(" AS ")
return f"{prefix}{sep}({select_sql})"

@override
def visit_create_table(self, create: CreateTable, **kw: Any) -> str:
table = create.element
Expand Down Expand Up @@ -502,9 +513,11 @@ def visit_computed_column(self, generated: Computed, **kw: Any) -> str:
)
return f"{clause} ({expression})"

def visit_create_view(self, create: CreateView, **kw: Any) -> str:
def visit_create_view(self, create: CreateView | BaseCreateView, **kw: Any) -> str:
name = getattr(create, "name", getattr(create, "table_name", None))
assert name, "Missing view name"
selectable = self.sql_compiler.process(create.selectable, literal_binds=True)
return f"CREATE VIEW {create.name} AS {selectable}"
return f"CREATE VIEW {name} AS {selectable}"

@override
def visit_drop_view(self, drop: DropView | BaseDropView, **kw: Any) -> str:
Expand Down
3 changes: 3 additions & 0 deletions test/test_sqlalchemy_dialect_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ def test_index_typed_comparison(self):
def test_path_typed_comparison(self):
pytest.skip("Path typed access is not supported")

def test_index_cross_casts(self):
pytest.skip("JSON joins are not supported")


class BizarroCharacterTest(_BizarroCharacterTest):

Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading