Skip to content

Commit 103941a

Browse files
committedNov 10, 2024
Fix query building edgecases, to support Wagtail on workers-dbms
1 parent c7ba34c commit 103941a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed
 

‎django_dbms/base.py

+9
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,20 @@ class DatabaseFeatures(SQLiteDatabaseFeatures):
2727

2828
class DatabaseOperations(SQLiteDatabaseOperations):
2929
pragma_foreign_keys = None
30+
cast_data_types = {
31+
"DateField": "TEXT",
32+
"DateTimeField": "TEXT",
33+
"PositiveIntegerField": "INTEGER",
34+
}
3035

3136
def _quote_columns(self, sql):
3237
"""
3338
Ensure column names are properly quoted and aliased to avoid collisions.
39+
Also handles CAST statements properly for NULL values.
3440
"""
41+
# First, fix any problematic CAST statements with None
42+
sql = sql.replace('None(', '(')
43+
3544
parsed = sqlparse.parse(sql)
3645
if not parsed:
3746
return sql # Unable to parse, return original SQL

‎pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "django-cf"
3-
version = "0.0.16"
3+
version = "0.0.17"
44
authors = [
55
{ name="Gabriel Massadas" },
66
]

0 commit comments

Comments
 (0)
Please sign in to comment.