44
55
66class DatabaseFeatures (BaseDatabaseFeatures ):
7+ # TODO: figure out compatible clickhouse version.
8+ minimum_database_version = None
79 # Use this class attribute control whether using fake transaction.
810 # Fake transaction is used in test, prevent other database such as postgresql
911 # from flush at the end of each testcase. Only use this feature when you are
@@ -17,33 +19,31 @@ class DatabaseFeatures(BaseDatabaseFeatures):
1719 # https://clickhouse.com/docs/en/sql-reference/data-types/string/
1820 # allows_group_by_lob = True
1921
20- # In clickhouse_backend MergeTree table family, PK have different meaning as in RDBMS
21- # PK is used for efficient range scans, pk can be duplicated, no auto incr pk.
22- # https://clickhouse.com/docs/en/engines/table-engines/mergetree-family/mergetree/#primary-keys-and-indexes-in-queries
23- allows_group_by_pk = False
24- allows_group_by_selected_pks = False
25-
2622 # There is no unique constraint in clickhouse_backend.
2723 # supports_nullable_unique_constraints = True
2824 # supports_partially_nullable_unique_constraints = True
29- supports_deferrable_unique_constraints = True
25+ # supports_deferrable_unique_constraints = False
3026
31- # Transaction is not supported, and limited transaction is under development .
27+ # Clickhouse only supports limited transaction.
3228 # https://clickhouse.com/docs/en/sql-reference/ansi/
3329 # https://github.com/ClickHouse/ClickHouse/issues/32513
30+ # https://clickhouse.com/docs/en/guides/developer/transactional
3431 @cached_property
3532 def uses_savepoints (self ):
3633 return self .fake_transaction
34+
3735 can_release_savepoints = False
3836
3937 # Is there a true datatype for uuid?
4038 has_native_uuid_field = True
4139
4240 # Clickhouse use re2 syntax which does not support backreference.
41+ # https://clickhouse.com/docs/en/sql-reference/functions/string-search-functions#matchhaystack-pattern
42+ # https://github.com/google/re2/wiki/Syntax
4343 supports_regex_backreferencing = False
4444
4545 # Can date/datetime lookups be performed using a string?
46- supports_date_lookup_using_string = False
46+ supports_date_lookup_using_string = True
4747
4848 # Confirm support for introspected foreign keys
4949 # Every database can do this reliably, except MySQL,
@@ -57,32 +57,27 @@ def uses_savepoints(self):
5757 'BinaryField' : 'BinaryField' ,
5858 'BooleanField' : 'BooleanField' ,
5959 'CharField' : 'CharField' ,
60- 'DurationField' : 'DurationField' ,
6160 'GenericIPAddressField' : 'GenericIPAddressField' ,
6261 'IntegerField' : 'IntegerField' ,
6362 'PositiveBigIntegerField' : 'PositiveBigIntegerField' ,
6463 'PositiveIntegerField' : 'PositiveIntegerField' ,
6564 'PositiveSmallIntegerField' : 'PositiveSmallIntegerField' ,
6665 'SmallIntegerField' : 'SmallIntegerField' ,
67- 'TimeField' : 'TimeField' ,
6866 }
6967
7068 # https://clickhouse.com/docs/en/sql-reference/statements/alter/index/
7169 # Index manipulation is supported only for tables with *MergeTree* engine (including replicated variants).
7270 supports_index_column_ordering = False
7371
7472 # Does the backend support introspection of materialized views?
75- can_introspect_materialized_views = False
73+ can_introspect_materialized_views = True
7674
7775 # Support for the DISTINCT ON clause
7876 can_distinct_on_fields = True
7977
8078 # Does the backend prevent running SQL queries in broken transactions?
8179 atomic_transactions = False
8280
83- # Does it support operations requiring references rename in a transaction?
84- supports_atomic_references_rename = False
85-
8681 # Can we issue more than one ALTER COLUMN clause in an ALTER TABLE?
8782 supports_combined_alters = True
8883
@@ -93,14 +88,11 @@ def uses_savepoints(self):
9388 supports_column_check_constraints = False
9489 supports_table_check_constraints = True
9590 # Does the backend support introspection of CHECK constraints?
96- can_introspect_check_constraints = False
91+ can_introspect_check_constraints = True
9792
9893 # What kind of error does the backend throw when accessing closed cursor?
9994 closed_cursor_error_class = InterfaceError
10095
101- # Does 'a' LIKE 'A' match?
102- has_case_insensitive_like = False
103-
10496 # https://clickhouse.com/docs/en/sql-reference/statements/insert-into/#constraints
10597 supports_ignore_conflicts = False
10698
@@ -119,11 +111,6 @@ def uses_savepoints(self):
119111 # SQL template override for tests.aggregation.tests.NowUTC
120112 test_now_utc_template = 'now64()'
121113
122- @cached_property
123- def supports_explaining_query_execution (self ):
124- """Does this backend support explaining query execution?"""
125- return True
126-
127114 @cached_property
128115 def supports_transactions (self ):
129116 return self .fake_transaction
0 commit comments