You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We submitted a patch the other day that added CrateDB into the mix, supporting it as both a source and destination pipeline element. Another patch intended to cover CrateDB software testing more extensively by deriving from the PostgreSQL tests, but that patch was too invasive and never got merged.
Use a dlt normalizer to adjust and convert database results transparently.
@coderabbitai came up with a suggestion for that proposal that is using psycopg2's register_type API to patch serialization on the OID level for 1114, 1184. That's a smart approach, right?
register_type scoped to the single connection (self._conn) in CrateDbSqlClient.open_connection() avoids polluting other psycopg2 connections in the same process — important since dlt[postgres] is a shared dependency.
It targets the actual root cause: CrateDB reports correct PostgreSQL OIDs (1114/1184) but serializes epoch-millisecond integers instead of ISO-8601 text, so psycopg2's built-in typecaster silently passes the raw int through.
It's a read-path fix on the connection, not a dlt normalizer (normalizers only run on the load/ingest path, not on query results from execute_sql()/execute_query()), which matches your original proposal's intent without misusing the wrong extension point.
UTC is safe to hardcode since CrateDB stores TIMESTAMP/TIMESTAMPTZ internally as UTC.
This should let the omniload test in this issue drop the CrateDB-specific branching and assert plain datetime values like the PostgreSQL path. I offered in the linked comment to open a PR against dlt-cratedb with a test extending tests/load/cratedb/test_cratedb_client.py — happy to kick that off if you'd like it filed as a follow-up here too.
@amotl Great news — DATE type support landing in CrateDB (crate/crate#19414, crate/crate#19588) removes the noise that made the earlier attempt too invasive, and #192 now shows a much cleaner integration test suite (87 passed, 71 skipped).
Activity
amotl commentedon Jul 7, 2026
Problem
The invasiveness is mostly due to constructs like this, where CrateDB's TIMESTAMP values obviously deviate from PostgreSQL's DATETIME.
Proposal
Use a dlt normalizer to adjust and convert database results transparently.
amotl commentedon Jul 7, 2026
@coderabbitai came up with a suggestion for that proposal that is using psycopg2's
register_typeAPI to patch serialization on the OID level for 1114, 1184. That's a smart approach, right?coderabbitai commentedon Jul 7, 2026
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 263
🏁 Script executed:
Length of output: 4231
🏁 Script executed:
Length of output: 6245
@amotlYes, it's a solid approach. Key points:register_typescoped to the single connection (self._conn) inCrateDbSqlClient.open_connection()avoids polluting otherpsycopg2connections in the same process — important sincedlt[postgres]is a shared dependency.psycopg2's built-in typecaster silently passes the raw int through.execute_sql()/execute_query()), which matches your original proposal's intent without misusing the wrong extension point.This should let the omniload test in this issue drop the CrateDB-specific branching and assert plain
datetimevalues like the PostgreSQL path. I offered in the linked comment to open a PR againstdlt-cratedbwith a test extendingtests/load/cratedb/test_cratedb_client.py— happy to kick that off if you'd like it filed as a follow-up here too.amotl commentedon Jul 15, 2026
We've refreshed the patch, and it looks much better today than on the previous attempt, thanks to improvements in CrateDB.
/cc @coderabbitai
coderabbitai commentedon Jul 15, 2026
Tip
For best results, initiate chat on the files or code changes.
🧩 Analysis chain
🏁 Script executed:
Length of output: 1839
🏁 Script executed:
Length of output: 1699
@amotlGreat news — DATE type support landing in CrateDB (crate/crate#19414, crate/crate#19588) removes the noise that made the earlier attempt too invasive, and#192now shows a much cleaner integration test suite (87 passed, 71 skipped).A few observations from
#192:DestinationSchemaTamperedstill point to gaps indlt-cratedbbeyond the DATE fix — worth tracking againstDestinationSchemaTamperederrors withmergeanddelete+insertstrategies orrefresh="drop_resources": Schema content was changed by a loader or by destination code crate/dlt-cratedb#14 and Fix CrateDBmerge,delete-insert, andrefresh="drop_resources"crashes crate/dlt-cratedb#51 as you noted.register_typeOID-level fix discussed earlier for TIMESTAMP/TIMESTAMPTZ serialization (Database result transformations for better PostgreSQL compatibility crate/dlt-cratedb#54), this should let the CrateDB-specific branching in the test assertions collapse to the same plain-datetimepath used for PostgreSQL.Let me know if you'd like me to look at any specific skipped test in
#192to help narrow down the remainingDestinationSchemaTamperedcases.