Skip to content

Commit dd05f12

Browse files
committed
Fix PK reflection
1 parent 6a43356 commit dd05f12

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

CHANGELOG.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
# Changelog
22

33
## [Unreleased]
4+
## [0.2.8] - 2025-01-30
5+
### Fixed
6+
- Table primary key reflection uses ``engine_reflection`` option. Enabled by default reflection leads to speed penalty during `system.tables` lookup.
7+
48
## [0.2.7] - 2024-10-18
59
### Fixed
610
- ClickHouse dialect extensions (FINAL, SAMPLE, LIMIT BY etc.) rendering in SQLAlchemy version 1.4.
711
- Unhashable type dict caused by full join. Solves issue [#276](https://github.com/xzkostyan/clickhouse-sqlalchemy/issues/276).
812

913
## [0.2.6] - 2024-03-25
10-
### Fixed (backported from 00.3.x)
14+
### Fixed (backported from 0.3.x)
1115
- [alembic] Table reflection for alembic version < 1.11. Solves issue [#274](https://github.com/xzkostyan/clickhouse-sqlalchemy/issues/274).
1216

1317
## [0.2.5] - 2023-10-29
@@ -334,7 +338,8 @@ Log, TinyLog, Null.
334338
- Chunked `INSERT INTO` in one request.
335339
- Engines: MergeTree, CollapsingMergeTree, SummingMergeTree, Buffer, Memory.
336340

337-
[Unreleased]: https://github.com/xzkostyan/clickhouse-sqlalchemy/compare/0.2.7...HEAD
341+
[Unreleased]: https://github.com/xzkostyan/clickhouse-sqlalchemy/compare/0.2.8...HEAD
342+
[0.2.8]: https://github.com/xzkostyan/clickhouse-sqlalchemy/compare/0.2.7...0.2.8
338343
[0.2.7]: https://github.com/xzkostyan/clickhouse-sqlalchemy/compare/0.2.6...0.2.7
339344
[0.2.6]: https://github.com/xzkostyan/clickhouse-sqlalchemy/compare/0.2.5...0.2.6
340345
[0.2.5]: https://github.com/xzkostyan/clickhouse-sqlalchemy/compare/0.2.4...0.2.5

clickhouse_sqlalchemy/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from .sql import Table, MaterializedView, select
55

66

7-
VERSION = (0, 2, 7)
7+
VERSION = (0, 2, 8)
88
__version__ = '.'.join(str(x) for x in VERSION)
99

1010

clickhouse_sqlalchemy/drivers/base.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,11 @@ def get_foreign_keys(self, connection, table_name, schema=None, **kw):
360360

361361
@reflection.cache
362362
def get_pk_constraint(self, connection, table_name, schema=None, **kw):
363-
if not self.supports_engine_reflection:
363+
should_reflect = (
364+
self.supports_engine_reflection and
365+
self.engine_reflection
366+
)
367+
if not should_reflect:
364368
return {}
365369

366370
if schema:

0 commit comments

Comments
 (0)