4
4
5
5
6
6
class DatabaseFeatures (BaseDatabaseFeatures ):
7
+ # TODO: figure out compatible clickhouse version.
8
+ minimum_database_version = None
7
9
# Use this class attribute control whether using fake transaction.
8
10
# Fake transaction is used in test, prevent other database such as postgresql
9
11
# from flush at the end of each testcase. Only use this feature when you are
@@ -17,33 +19,31 @@ class DatabaseFeatures(BaseDatabaseFeatures):
17
19
# https://clickhouse.com/docs/en/sql-reference/data-types/string/
18
20
# allows_group_by_lob = True
19
21
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
-
26
22
# There is no unique constraint in clickhouse_backend.
27
23
# supports_nullable_unique_constraints = True
28
24
# supports_partially_nullable_unique_constraints = True
29
- supports_deferrable_unique_constraints = True
25
+ # supports_deferrable_unique_constraints = False
30
26
31
- # Transaction is not supported, and limited transaction is under development .
27
+ # Clickhouse only supports limited transaction.
32
28
# https://clickhouse.com/docs/en/sql-reference/ansi/
33
29
# https://github.com/ClickHouse/ClickHouse/issues/32513
30
+ # https://clickhouse.com/docs/en/guides/developer/transactional
34
31
@cached_property
35
32
def uses_savepoints (self ):
36
33
return self .fake_transaction
34
+
37
35
can_release_savepoints = False
38
36
39
37
# Is there a true datatype for uuid?
40
38
has_native_uuid_field = True
41
39
42
40
# 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
43
43
supports_regex_backreferencing = False
44
44
45
45
# Can date/datetime lookups be performed using a string?
46
- supports_date_lookup_using_string = False
46
+ supports_date_lookup_using_string = True
47
47
48
48
# Confirm support for introspected foreign keys
49
49
# Every database can do this reliably, except MySQL,
@@ -57,32 +57,27 @@ def uses_savepoints(self):
57
57
'BinaryField' : 'BinaryField' ,
58
58
'BooleanField' : 'BooleanField' ,
59
59
'CharField' : 'CharField' ,
60
- 'DurationField' : 'DurationField' ,
61
60
'GenericIPAddressField' : 'GenericIPAddressField' ,
62
61
'IntegerField' : 'IntegerField' ,
63
62
'PositiveBigIntegerField' : 'PositiveBigIntegerField' ,
64
63
'PositiveIntegerField' : 'PositiveIntegerField' ,
65
64
'PositiveSmallIntegerField' : 'PositiveSmallIntegerField' ,
66
65
'SmallIntegerField' : 'SmallIntegerField' ,
67
- 'TimeField' : 'TimeField' ,
68
66
}
69
67
70
68
# https://clickhouse.com/docs/en/sql-reference/statements/alter/index/
71
69
# Index manipulation is supported only for tables with *MergeTree* engine (including replicated variants).
72
70
supports_index_column_ordering = False
73
71
74
72
# Does the backend support introspection of materialized views?
75
- can_introspect_materialized_views = False
73
+ can_introspect_materialized_views = True
76
74
77
75
# Support for the DISTINCT ON clause
78
76
can_distinct_on_fields = True
79
77
80
78
# Does the backend prevent running SQL queries in broken transactions?
81
79
atomic_transactions = False
82
80
83
- # Does it support operations requiring references rename in a transaction?
84
- supports_atomic_references_rename = False
85
-
86
81
# Can we issue more than one ALTER COLUMN clause in an ALTER TABLE?
87
82
supports_combined_alters = True
88
83
@@ -93,14 +88,11 @@ def uses_savepoints(self):
93
88
supports_column_check_constraints = False
94
89
supports_table_check_constraints = True
95
90
# Does the backend support introspection of CHECK constraints?
96
- can_introspect_check_constraints = False
91
+ can_introspect_check_constraints = True
97
92
98
93
# What kind of error does the backend throw when accessing closed cursor?
99
94
closed_cursor_error_class = InterfaceError
100
95
101
- # Does 'a' LIKE 'A' match?
102
- has_case_insensitive_like = False
103
-
104
96
# https://clickhouse.com/docs/en/sql-reference/statements/insert-into/#constraints
105
97
supports_ignore_conflicts = False
106
98
@@ -119,11 +111,6 @@ def uses_savepoints(self):
119
111
# SQL template override for tests.aggregation.tests.NowUTC
120
112
test_now_utc_template = 'now64()'
121
113
122
- @cached_property
123
- def supports_explaining_query_execution (self ):
124
- """Does this backend support explaining query execution?"""
125
- return True
126
-
127
114
@cached_property
128
115
def supports_transactions (self ):
129
116
return self .fake_transaction
0 commit comments