
dbt Redis adapter: NYC taxi example project¶
Run the commands in this guide from v1/ (cd v1 from the repository root).
The repository overview describes the v1/v2 layout.
To install the published adapter in your own project, start with the installation and first-model guide.
A dbt Core project that tests the dbt Redis adapter, which is built on the Redis ADBC driver. It does three things:
- loads the NYC TLC yellow-taxi trips CSV into Redis,
- transforms it with ordinary dbt SQL: views, tables, an incremental MERGE
fact table, a microbatch model, a snapshot, a model contract, joins, window
functions, CTEs and
QUALIFY, plus a Python model over Arrow, - tests and documents it with dbt's standard commands, and stores the model descriptions in Redis as comments.
dbt's own default materializations do the work: tables, views, incremental
models (temporary tables plus MERGE or delete+insert) and snapshots. The SQL
dbt generates runs on the driver unchanged.
dbt ──► dbt-redis-adbc (adapter/) ──► adbc_driver_manager ──► libadbc_driver_redis ──► Redis 8
Python + Jinja ADBC DB-API SQL → FT.AGGREGATE / HASH
Contents¶
- Quick start
- Project guide
- Validation and testing
- Repository reference
- Adapter reference
- Compatibility and limitations
- Redis operations
- Data source
Quick start¶
Requirements¶
You need a dedicated Redis Enterprise cluster with TLS and username/password
authentication, uv (it provides Python
3.14 for dbt), and network access to hub.getdbt.com for dbt deps.
Building the driver from source also needs Go 1.27.4 or newer and a C
toolchain; on macOS arm64 and Linux (x86-64, arm64) the prebuilt one is used.
The driver's repo, redis/redis-adbc-driver,
is public. Releases download through the GitHub CLI
when logged in, or through HTTPS without authentication.
Set up the environment¶
To provision a dedicated local Enterprise cluster, run
python3 scripts/redis_enterprise.py up from the repository root, then
source .redis-enterprise/env.sh and return to v1/. See the
environment guide for topology, TLS trust, and lifecycle.
If using that generated environment, keep its connection variables instead of
the placeholders below.
Configure a dedicated test database with the Query Engine enabled, a certificate trusted by the test machine, and an ACL user allowed to create, read, update, and drop test data. Set credentials in the environment before running setup:
export REDIS_URI=rediss://your-enterprise-endpoint:port/0
export REDIS_USERNAME=your-test-user
export REDIS_PASSWORD='<your-test-password>'
make setup
make setup validates the authenticated TLS configuration, then:
- runs
uv syncanddbt deps(dbt_utils, and the localredis_adbc_utils) - puts the driver in
driver/: the prebuilt library from the latest published release, after checking its SHA-256. When upgrading from an older driver storage format, use a fresh, isolated Redis database and reload sources/models; the driver rejects incompatible existing storage without modifying it. See driver storage requirements. Where the release has no build (another platform, orDRIVER_VERSIONset to a commit) it builds the driver from source instead;make driver-buildalways does - downloads the CSV into
data/
Build the project¶
make all
make all runs dbt debug, seed, run-operation load_raw_trips, build
and docs generate. Three demos show what happens across runs.
Run the demos¶
Load the first half of January, then the rest: fct_trips merges the new trips, and agg_zone_daily replaces the zone-days they touch (delete+insert on a composite key):
make incremental-demo
Rename a zone between two snapshots; its history keeps both versions:
make snapshot-demo
Backfill January 1–3 as three daily batches (run in parallel), then re-run January 2 alone, which replaces only that day:
make microbatch-demo
To see what an API reading the target sees when a batch fails, run this after
make all (see issue #42):
make microbatch-failure-demo
The failure demo copies the taxi microbatch model into a temporary project. It
reads taxi_intermediate.int_trips_enriched and writes only a random
dbt_microbatch_failure_* schema, which it drops on exit. For another input
schema, use ARGS="--source-schema your_intermediate_schema". It uses the
connection environment variables below; it does not load a custom profile.
Keep the source stable during the demo so recovery can be compared exactly.
A separate dbt process backfills January 1–3. On the January 2 refresh, a
demo-only client fault injector intercepts the generated DELETE/INSERT SQL,
sends the actual DELETE, and pauses before sending INSERT. The reader keeps
the same independent ADBC connection open and issues fresh queries during the
interrupted refresh and at every checkpoint.
After it observes the gap, the demo terminates the writer, then reruns just
January 2 twice through dbt without fault injection or --full-refresh.
There is no timing race to hit the interruption point, and production adapter
macros and model SQL are unchanged.
| Reader checkpoint | January 1 | January 2 | January 3 |
|---|---|---|---|
| Before refresh | Expected rows | Expected rows | Expected rows |
| DELETE complete, writer paused | Unchanged | No rows | Unchanged |
| Writer terminated | Unchanged | Still no rows | Unchanged |
| Same batch rerun | Unchanged | Restored | Unchanged |
| Same batch rerun again | Unchanged | Restored, no duplicates | Unchanged |
The command prints observed per-day counts at each checkpoint and fails if any
row or value differs from the expected source, if a trip_id is duplicated,
or if a neighboring day's rows change. CI runs it against the loaded taxi data.
The table describes the deliberately paused statement boundary; reads during
an actively executing DELETE or INSERT may also see partial progress. This
demo does not assert statement-level atomicity.
For an API, a refresh can therefore return a successful but incomplete query result. Autocommit leaves the missing day visible until recovery; terminating the writer does not roll it back. Rerunning the same window replaces its rows, which also removes partial inserts before reloading. If an API requires a complete published dataset throughout refresh, build and validate a separate version and have the application switch its active version only after success. Retain the previous version for existing readers; this demo does not establish an atomic SQL rename/swap guarantee.
Use make docs-serve to browse the docs and lineage graph.
Configure the connection¶
All integration testing uses a dedicated Redis Enterprise cluster with TLS.
REDIS_URI must use rediss://host:port/0, and REDIS_USERNAME and
REDIS_PASSWORD must both be set. There is no local container fallback.
Keep certificate verification enabled. For a private CA, set
REDIS_TLS_CA_FILE to its PEM bundle; the profile passes it through the
driver's adbc.redis.tls_ca_file option on macOS and Linux. Set REDIS_TIME_ZONE for the session time
zone (UTC by default) and REDIS_ADBC_DRIVER for the driver location.
Redis Flex (RAM + SSD) databases aren't supported.
Project guide¶
dbt command coverage¶
| Command | What happens in Redis |
|---|---|
dbt debug |
Opens an ADBC connection. The driver checks that the Query Engine is available (FT._LIST) and that FT.AGGREGATE works, which is how it refuses Redis Flex |
dbt seed |
4 lookup CSVs (zones, payment types, rate codes, vendors), loaded with ADBC bulk ingest; reloads use TRUNCATE |
dbt run-operation load_raw_trips |
Streams the 134 MB gzipped CSV with pyarrow, keeps every 50th row (~153k trips across January), adds trip_id (the trip's row number in the file), and bulk-ingests it into raw.yellow_tripdata in 6–10 s |
dbt run |
5 views and 8 tables, rebuilt with dbt's create-then-ALTER … RENAME swap, and agg_daily_revenue_zscores, a Python model: dbt reads agg_daily_revenue into its own process as a pyarrow Table, and the result is bulk-ingested into the new table; plus 2 incremental models built from a CREATE TEMPORARY TABLE: fct_trips with MERGE, and agg_zone_daily with delete+insert on (pickup_date, pickup_location_id). dim_zones has an enforced contract, so it's created from its DDL (with NOT NULL and CHECK constraints) and then filled with INSERT. The marts' descriptions are stored with COMMENT ON |
dbt run --event-time-start … --event-time-end … |
fct_trips_microbatch (off unless microbatch_demo is set): one batch per pickup day; each batch deletes its day, then inserts it |
dbt snapshot |
zones_snapshot: SCD type 2 history of the zone lookup (check strategy; a deleted zone gets a closing version), written by dbt's snapshot MERGE |
dbt test / dbt build |
60 data tests (unique, not_null, accepted_values, relationships, dbt_utils' unique_combination_of_columns / accepted_range, custom generic non_negative / in_range, 5 singular tests, one of which checks the Python model's z-scores against SQL) and 2 unit tests |
dbt show, dbt compile, dbt ls |
Previews, inline queries, and the analysis in analyses/ |
dbt build --empty --exclude-resource-type snapshot |
Builds and tests every model with no rows, in about 6 s. dbt reads each ref and source as (select * from … where false limit 0), which the driver answers without reading the table. Tables, views and seeds are left empty (a view keeps the where false limit 0 in its SQL; incremental models keep their rows), so run make all afterwards. Leave out the snapshot: with an empty source, hard_deletes: new_record would record every zone as deleted |
dbt docs generate |
Catalog built from ADBC GetObjects (column types, tables vs views), with the comments the marts store through persist_docs |
A clean make all takes 1.5–2 minutes on a laptop. It ends with 82 passes and 1
intended warning: the source test flags a $623,261.66 fare in the raw
data, which staging filters out.
Validation and testing¶
Continuous integration¶
.github/workflows/ci.yml runs on every pull
request and push to main, against a Redis Enterprise test cluster and the
latest released driver. Each integration job provisions its own three-shard Enterprise
cluster with Search, TLS, a generated private CA, and a named database user.
The setup masks the generated password and exports the connection settings
through GITHUB_ENV; no preconfigured database secrets are needed. Jobs run
against isolated databases, including each taxi dependency matrix entry. CI runs:
make all, failing on any error and unless the build gives exactlyPASS=82 WARN=1- the three demos, checking the numbers they print
dbt build --empty --exclude-resource-type snapshot
scripts/ci_check.py does the checks. It runs on
Python 3.14 with the locked versions and with the oldest ones
the pyproject.toml files allow: dbt-core 1.12.0, dbt-adapters 1.24.5, Mashumaro 3.17,
adbc-driver-manager 1.6 and pyarrow 26. Each run takes 3–5 minutes.
CI also runs dbt's adapter test suite on Python 3.14, with the locked versions only: dbt-tests-adapter needs newer dbt packages than the oldest ones.
Every CI run, including pull requests, nightly builds and release validation, resolves the driver's latest published release. Run the workflow by hand to repeat validation against the current release.
CI also audits the locked Python runtime and test dependencies and the optional
v2 Python runtime with pip-audit. The current runtime uses PyArrow 26 and the
test suite uses Polars 2. Python 3.14 is the minimum supported version. The project
constrains certifi to 2026.10.19 or newer to address GHSA-6q48-6c7w-9gw2. See
dependency upgrade notes for upstream constraints that prevent
some transitive dependencies from reaching their latest release.
CI downloads releases from the public redis/redis-adbc-driver repository
using the built-in github.token for GitHub API requests. Source builds clone
the public repository. No separate driver repository secret is required.
dbt's adapter test suite¶
The project tests the dbt features it uses. adapter/tests/functional/
runs dbt Labs' dbt-tests-adapter
suite, which other adapters run too, against the adapter. That covers the rest:
- ephemeral models
- model, seed, snapshot and run hooks
- dbt clone and dbt retry
- --store-failures and --sample
- both snapshot strategies and their hard_deletes modes
- on_schema_change and incremental_predicates
- contracts and constraints
- every cross-database macro
- persist_docs, unit tests, query comments, relation caching and concurrency
make adapter-tests
It runs uv run pytest -n 4 against REDIS_URI (the same variables as the
project). Each test class creates its own schemas and drops them afterwards,
but use a scratch Redis anyway. It takes about a minute.
Where a test's fixture is Postgres SQL, the test module overrides the fixture,
not the adapter. For example:
- a contract on select 1 as id declares bigint, the driver's type for an
integer literal (Postgres's is integer);
- dates are ISO, not '09/01/2023';
- relations render as schema.table.
Transport-specific checks run in separate jobs. A native-only functional run skips the Flight SQL module; the authenticated Flight job executes those cases. General grants fixtures are replaced by a dedicated native SELECT contract suite with provisioned reader roles and ACLs. Clone fallback/state validation, Python incremental models, string semantics and the single-relation catalog API now run as ordinary tests. Native zero-copy cloning remains false and has active capability/fallback coverage. See the contract coverage record.
The latest released driver supports all snapshot tests, including dbt_valid_to_current
with date(x); these run as ordinary tests so regressions fail CI.
Repository reference¶
Project layout¶
Paths below are relative to v1/.
models/
staging/ views over raw + seeds: rename, type, filter, derive hour/weekday/duration
intermediate/ int_trips_enriched: trips ⋈ zones (×2) ⋈ payment types ⋈ rate codes ⋈ vendors
marts/ fct_trips (incremental MERGE), agg_zone_daily (incremental delete+insert on a
composite key), fct_trips_microbatch (optional), dim_zones
(enforced contract), agg_daily_revenue (7-day rolling average, LAG, RANK),
agg_top_pickup_zones (RANK … QUALIFY), agg_hourly_demand, agg_borough_flows,
agg_payment_mix, agg_airport_trips, agg_daily_revenue_zscores (a Python model,
pyarrow)
snapshots/ zones_snapshot (SCD type 2 of the zone lookup)
seeds/ taxi_zone_lookup, payment_types, rate_codes, vendors
macros/ load_raw_trips and rename_zone (run-operations), day_part
tests/ generic (non_negative, in_range) and singular tests, including dbt's
cross-database macros
analyses/ top_pickup_zones_by_day_part
adapter/ the dbt-redis-adbc adapter package (installed editable by uv), and
tests/functional: dbt's adapter test suite
redis_adbc_utils/ redis_adbc__ overrides for dbt_utils, dbt_date and dbt_expectations macros
scripts/ download_driver.sh, build_driver.sh, driver-version, download_data.sh,
ci_check.py (CI's checks)
Project variables¶
Useful vars (defaults are in dbt_project.yml):
| Var | Default | Meaning |
|---|---|---|
raw_trips_sample_every |
50 |
Keep every Nth CSV row. 1 loads all ~7.7M rows, which needs several GB of Redis memory |
raw_trips_limit |
none | Cap on rows loaded |
trips_start / trips_end |
all of January 2019 | Pickup window kept by staging |
max_total_amount |
2000 |
Larger totals are treated as data errors |
lookback_hours |
6 |
Hours before the latest loaded pickup that each incremental run re-merges |
top_zones_per_borough |
3 |
Zones kept per borough by agg_top_pickup_zones |
microbatch_demo |
false |
Enables fct_trips_microbatch |
Adapter reference¶
Responsibilities¶
dbt only connects to a database through an adapter package, and there is no
generic ADBC adapter. adapter/ is a small one: about 780 lines of Python and
290 lines of macros. The driver runs the SQL of dbt's default macros and
materializations, so the adapter covers what isn't SQL:
| Area | Adapter |
|---|---|
| Connection | adbc_driver_manager DB-API, autocommit. The driver has no transactions: it accepts dbt's BEGIN/COMMIT as no-ops, and a SET LOCAL lasts until the model's COMMIT, as on Postgres. Results over 65,536 rows stream from the driver, so an error in a later batch is raised as dbt reads the rows; the adapter reports it as a database error, like one from the query. Ctrl-C and --fail-fast cancel the running statements and streamed results (ADBC StatementCancel); each fails with CANCELLED, which the adapter reports as a runtime error rather than a database error |
| Metadata | Relations, columns and the docs catalog come from ADBC GetObjects; table comments come from information_schema.tables. Relations are matched with their case, since the driver keeps schema and table names as written (alias='MyTable' works). Column types are parsed as dbt-postgres reports them (numeric with precision and scale, character varying with its length) |
| Model indexes | indexes config creates named nonunique Redis Search indexes on tables and initial/full-refresh incremental builds; btree and hash are compatibility hints. See configuration and lifecycle |
persist_docs |
Descriptions are stored with COMMENT ON TABLE / VIEW / COLUMN; the marts turn it on |
grants |
Native SELECT grants use dedicated Redis Software ACLs when adbc.redis.rbac is configured; otherwise skipped with a warning. See setup. |
| Temporary tables | make_temp_relation renders them unqualified (a schema-qualified name always means a permanent table), and their columns are looked up under pg_temp |
| Incremental strategies | append, delete+insert (the default with a unique_key), merge, and microbatch (each batch replaces its event_time window; batches can run in parallel) |
| Seed reloads | A reload without --full-refresh checks the CSV's columns before truncating, so a mismatch leaves the table as it was (there's no transaction to roll the TRUNCATE back) |
| Loading | Seeds and the raw CSV go through Arrow bulk ingest, which is much faster than INSERTs. The driver converts each seed value to its column's type as an INSERT would, and supplies the Arrow type for each of the raw CSV's SQL column types |
| Python models | Run in the dbt process, as dbt-duckdb runs them: Redis has no Python runtime, but the driver evaluates most SQL in the dbt process too. dbt.ref() and dbt.source() return a pyarrow.Table (select * from …, read with fetch_arrow_table()); session is the thread's ADBC DB-API connection, for running SQL. model() returns a pyarrow Table or RecordBatchReader, a pandas or polars DataFrame (a pandas index is dropped), or anything with the Arrow stream interface; it's bulk-ingested into the __dbt_tmp table, and dbt's rename swap finishes the job. Table builds use dbt's rename swap; Python incremental builds stage Arrow once and apply append, delete+insert or merge, with --full-refresh replacing the target; tracebacks give the model file's line numbers. As dbt specifies, --empty and --sample don't limit a Python model's refs (sources are) |
| Cross-database macros | dbt-core's defaults work natively except two: safe_cast uses the driver's TRY_CAST, and listagg with limit_num raises a clear error (the adapter has no translation for dbt's ARRAY_SLICE form). tests/assert_cross_db_macros.sql checks them all |
| Model contracts | An enforced contract creates the table from its DDL, then inserts the rows (as on dbt-postgres). not_null and check are enforced by the driver; primary_key, unique and foreign_key are accepted but not enforced (dbt warns) |
| Small dialect bits | ? bind parameters, CURRENT_TIMESTAMP (and current_timestamp_in_utc_backcompat in UTC, which dbt's default isn't in a non-UTC session), validate_sql with a query that can't return rows (the driver has no EXPLAIN), a subquery wrapper for dbt show --limit, and no alias on the subqueries --empty and microbatch put around refs, so a model's own alias (from {{ ref('x') }} z) still works |
Materialized views¶
SQL models can use the native ADBC materialized-view lifecycle:
{{ config(
materialized='materialized_view',
indexes=[{'columns': ['customer_id'], 'type': 'btree'}],
on_configuration_change='apply'
) }}
select customer_id, sum(amount) as amount
from {{ ref('orders') }}
group by customer_id
- The first build creates a populated native materialized view. Subsequent
dbt run/dbt buildcommands refresh its stored query from current sources. - Changes to the model SQL require
--full-refresh. It builds and indexes an intermediate materialized view before renaming the old target to a backup, publishing the new name, and dropping the backup. Switching to/fromtableorviewuses the corresponding native relation type. indexesaccepts a list of dictionaries withcolumns(exact column names), optionaltype(btreeorhash, Redis Search compatibility hints), and optionalunique: false. UNIQUE, expression, and partial indexes are rejected. Multiple indexes and quoted mixed-case column names are supported. The released v0.0.27 driver rejects index columns containing spaces. Source commit41d468dadds support; see driver #449.- Index configuration changes use
on_configuration_change:apply(default) adds/removes the materialization's named indexes and refreshes;continuewarns and skips the model;failerrors before model DDL. Full refresh always uses the current configuration. External named indexes are preserved on refresh; replacement drops the old relation and its indexes. - Hooks, grants warnings, and
persist_docswork as for other SQL models. Discovery and the dbt cache usematerialized_view; the docs catalog reportsMATERIALIZED VIEW. Interrupted runs may leave intermediates/backups, which the next build cleans up using their discovered types.
The native driver SQL was introduced in v0.0.20; the materialized-view lifecycle is validated with v0.0.27. The previous example pin, v0.0.18, does not support these statements. v0.0.23+ uses storage protocol 17 and rejects earlier driver catalogs; use a fresh isolated driver database or a driver-supported import path when upgrading. Replacing the library alone does not migrate existing data. Upgrade all clients accessing materialized views together.
The adapter emits plain REFRESH MATERIALIZED VIEW; it does not expose
CONCURRENTLY or WITH NO DATA. Refresh/build failures preserve the prior
published target, but the rename sequence and index changes are separate
committed statements. These options do not claim PostgreSQL transaction or
uninterrupted concurrent-reader semantics, or direct dbt-postgres wire-protocol
compatibility. Driver reader-consistency work is tracked separately in
driver issue #105.
The original qualification on adapter base 2f686af encountered v0.0.27
catalog-publication conflicts; see
driver #448. The adapter
now includes safe publication retries, and driver source commit 36f456a adds
native catalog-write coordination. The validation record distinguishes the
original v0.0.27 results from source-build revalidation.
See recorded validation for the native dbt build, test, catalog, and failure-recovery results on Redis Software with 4× QPF.
Package compatibility¶
dbt looks for a package macro's adapter variants only in the
root project and the package itself, so the adapter can't fix a package's
default__ macros that are wrong here. redis_adbc_utils/
holds those fixes:
- dbt_utils.deduplicate: the default drops rows with NULLs.
- dbt_expectations' regex flags: the default ignores them.
- dbt_date's day and month names, and its week and ISO-week macros: the
defaults use Snowflake semantics.
This project installs it with dbt_utils and puts it first in
dispatch:. Copy that setup to use those packages with Redis.
Profile configuration¶
Profile options (profiles.yml): driver (the library's path; without an
extension, the adapter adds .dylib, .so or .dll), uri, username,
password, database (optional; always redis), schema, threads,
aggregate_pushdown (exact / all / none), rename_rekey (see
Looking at the data in Redis), and:
-
transport:redis(default) loads Redis ADBC directly;flightsqlloads the ADBC Flight SQL client and connects to a Redis-backed Flight server. Installdbt-redis-adbc[flightsql], use agrpc://orgrpc+tls://URI, and enable server sessions. Schema and time zone are set per session; Redis-specific options must be configured on the server. See the Flight SQL profile. -
time_zone: the session time zone, for exampleAmerica/New_York(UTC by default).current_timestampshows in it,localtimestampand snapshots'dbt_valid_from/dbt_valid_toare its local time, andTIMESTAMP↔TIMESTAMP WITH TIME ZONEconversions use it, as on Postgres. So do seeds: a timestamp without an offset in aTIMESTAMP WITH TIME ZONEcolumn is a local time, as on dbt-postgres. read_timeout/write_timeout: how long the client waits for each reply and to send each command:30s,10m, a number of seconds, or0for no timeout (5 minutes by default). Raiseread_timeouton a cluster or a busy server.driver_options: any other driver option, passed as is, for example{adbc.redis.stream_batch_rows: 10000}. The driver refuses an unknown one when dbt connects. Options that have a profile key of their own (adbc.redis.time_zone,password, …) must be set with it.
dbt debug shows these options with driver option values redacted. A profile key the adapter doesn't know is
ignored with a warning.
Compatibility and limitations¶
Driver issues found along the way¶
Building this project turned up these issues, all filed on redis/redis-adbc-driver. All of them were fixed by driver v0.0.18 and remain covered on the latest release.
| Issue | Fixed in |
|---|---|
| #13 Bound string parameters read freed memory | #15 |
#17, #18 Slow IN (SELECT …) (57 s → 0.9 s) and correlated EXISTS (28 s → 2 ms) |
#38 |
| #19 Window functions | #35 |
#20 MERGE, UPDATE … FROM, DELETE … USING |
#29 |
| #21 Temporary tables | #30 |
| #22 Renaming views | #27 |
#23 INSERT … (SELECT), TRUNCATE, DROP … CASCADE |
#25 |
#24 ROUND, SUBSTRING, NULLIF and other scalar functions |
#28 |
#31, #32 SELECT DISTINCT / DISTINCT ON, qualified t.* |
#39 |
#33 CONCAT returned NULL for any NULL argument |
#34 |
#36 Wrong results: rounded constants pushed into the index (int_col > 1.5) |
#40 |
#37 Slow literal IN lists over 1,000 values (66 s → 1 s) |
#41 |
#43 Column DEFAULTs accepted but never applied |
#57 |
#44, #45, #50 TRY_CAST, % on NUMERIC, DATEADD / DATEDIFF (dbt's dateadd, datediff, last_day, date_spine) |
#56 |
#46, #47 STRING_AGG, BOOL_OR, ANY_VALUE, statistics and percentiles; FILTER, IGNORE NULLS, frame EXCLUDE (dbt's listagg, bool_or, any_value) |
#62 |
#48 GROUPING SETS, ROLLUP, CUBE |
#59 |
| #49 Regular expressions | #61 |
#51 RETURNING, UPDATE … SET (a, b) = (…) |
#58 |
#52 WITH RECURSIVE, LATERAL, ANY / ALL, NATURAL JOIN, GENERATE_SERIES |
#68 |
| #53 JSON functions | #64 |
#54 Renamed tables keep their old key prefix (opt-in fix: rename_rekey) |
#69 |
#72 COMMENT ON (dbt's persist_docs) |
#73 |
#74 WHERE false / LIMIT 0 ran the whole query (dbt's contract checks, --empty: 5 s → 2 ms on dim_zones) |
#77 |
#75 Column-level CHECK / REFERENCES didn't parse; CHECK wasn't enforced |
#76 |
#78 Unknown functions were only caught when a row was evaluated, so they passed contract checks and --empty |
#79 |
#82 Wrong results: a table re-created after a concurrent DROP read the dropped table's leftover rows |
#99 |
#83, #101 SUM / AVG of DOUBLE varied with row order and pushdown mode, and gave NaN with aggregate_pushdown=all on a cluster |
#107 |
#84, #88, #90 Timestamp text kept trailing zeros; no AT TIME ZONE / convert_timezone(); to_char printed WW, J, … literally (dbt_utils' generate_surrogate_key, dbt_date) |
#97 |
#85 Row values, (k1, k2) IN (…) (dbt's delete+insert with a list unique_key) |
#98 |
#86, #87, #94 A 5–10 s client read timeout; a killed rename_rekey rename blocked retries; incomplete ACL docs |
#100 |
#89 Trigonometric functions (dbt_utils' haversine_distance) |
#107 |
#91, #92 Multi-action ALTER TABLE (on_schema_change); BEGIN / COMMIT / SET (hooks outside the transaction) |
#96 |
#93 VARCHAR(n) / CHAR(n) lengths were ignored |
#95 |
#102 Wrong results: t.col inside (… from t x …) read the inner row |
#108 |
| #103, #105 Casts to a lower time precision truncated; no session time zone | #106 |
#104 Data loss: TRUNCATE … RESTART IDENTITY during a concurrent write |
#109 |
#110 Rows whose DOUBLE column is NaN were written but never returned |
#116 |
#111 Wrong results: schema-qualified column references (s.t.col) ignored the schema |
#115 |
#112 GROUP BY didn't reject ungrouped outer columns inside subqueries |
#117 |
| #113 Fractional-second precisions other than 0, 3, 6 and 9 snapped to 3, 6 or 9 digits | #118 |
#150 A cancel didn't stop work the driver does in memory (Ctrl-C lagged by a whole join), and was reported as IO |
#152 |
| #151 Seeds (bulk ingest) read timestamps without an offset as UTC in a non-UTC session | #153 |
dbt's adapter test suite also found these issues:
- #187: fixed
by v0.0.16.
UNIONnow resolvesDATEandTIMESTAMPtogether, allowing timestamp-strategy snapshots with aDATEupdated_atand hard deletes. - #188: fixed
by v0.0.18.
date(x)now works, includingdbt_valid_to_currentexpressions. - #232: fixed
by v0.0.16. Repeated columns in
DISTINCTnow work, including delete+insert with a repeatedunique_keysuch as['state', 'state'].
The v0.0.16 driver folds unquoted SQL identifiers to lowercase. Quote
mixed-case CSV column names such as "VendorID" and "LocationID" when
referencing them. Integer literals report INTEGER, so model contracts for
expressions such as select 1 as id should declare integer.
Known limitations¶
The driver runs the SQL that dbt and its cross-database macros generate, and the dbt features above all work. These limits come from the design:
- No transactions. Every statement autocommits, so a run that stops in
the middle of a materialization can leave a
__dbt_tmpor__dbt_backuprelation behind. dbt drops those at the start of the next run of that model. The run's temporary tables (pg_temp_N) stay until the driver's 2-minute heartbeat for that connection runs out; the next connection then removes them. Ctrl-C and--fail-fastcancel the running statements, which leaves the same kind of remains. Each fails withCANCELLED: work the driver does in memory (a join, say) stops within milliseconds, and a Redis command or a streameddbt showresult once the reply it waits for arrives. A statement that was writing keeps the rows it already wrote until the next run drops its relation. A cancelledrename_rekeyrename leaves the table as it was. For microbatch, stopping after DELETE leaves that window missing from the live target until the same batch is rerun; there is no rollback. Runmake microbatch-failure-demoto observe this with an independent reader and verify recovery without duplicates. - Python models run in the dbt process. Each ref a
Python model reads is loaded whole into dbt's memory. Python incremental models support append, delete+insert and merge through
Arrow staging; Python microbatch and enforced incremental contracts remain
unsupported. dbt runs
dbt showand unit tests of a Python model as SQL, so neither works on any adapter. - Materialized-view consistency follows the driver. Refresh and replacement autocommit. No PostgreSQL multi-statement transaction or uninterrupted concurrent-reader guarantee is implied. See materialized views.
- Limited grants. Opt-in native SELECT grants require a driver with enforced RBAC support and provisioned dedicated Redis Software ACLs. Other privileges, view grants and Flight SQL grants are unsupported. Without configuration, grants retain the historical skip-with-warning behavior.
Redis operations¶
Access control¶
dbt can run as a Redis ACL user (username / password in profiles.yml).
The commands and key patterns the driver needs, per feature, and a read-only
user recipe are in the
driver's README.
A read-only user can run dbt show, the data tests
and docs generate. Unit tests and snapshots create temporary tables, which
need INCRBY on the driver's metadata keys, so they fail for a read-only
user (dbt reports the unit-test failure as a data-type mismatch).
Looking at the data in Redis¶
Each row is a HASH, and each table has a RediSearch index. On a cluster, add
-c to redis-cli so it follows the key to its shard:
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli --tls -u "$REDIS_URI" --user "$REDIS_USERNAME" HGETALL raw:yellow_tripdata:1
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli --tls -u "$REDIS_URI" --user "$REDIS_USERNAME" FT.INFO idx:raw:yellow_tripdata
Tables built by dbt's rename-swap keep the row key prefix and index of the
__dbt_tmp table they were created as. ALTER TABLE … RENAME only changes
metadata, and the driver never gives a new table a prefix another table had
(so a dropped or truncated table's leftover keys can't reach it). Each build's
__dbt_tmp therefore gets the next free one: …__dbt_tmp:, …__dbt_tmp~2:,
~3 and so on. A table also takes the next names when an index the driver
didn't create already has its index's name (an application's
idx:taxi:users, say), and leaves that index and its HASHes alone. To get
keys named after the table, set rename_rekey: true in
profiles.yml. Each rename then moves the table's rows to keys under its own
name (schema:table: on the first build, schema:table~N: after that). For a
rebuilt table that costs one copy of its new rows: the adapter drops the old
table instead of moving it to __dbt_backup first.
Either way, a table's current prefix and index are in its metadata:
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli --tls -u "$REDIS_URI" --user "$REDIS_USERNAME" GET 'adbc:{meta}:table:taxi_marts:agg_daily_revenue'
The metadata also holds the comments persist_docs writes. They're easier to
read through information_schema:
uv run dbt show --inline "select table_name, comment from information_schema.tables where table_schema = 'taxi_marts'"
To watch the FT.AGGREGATE / HMGET traffic while dbt runs:
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli --tls -u "$REDIS_URI" --user "$REDIS_USERNAME" MONITOR
Data source¶
NYC TLC yellow taxi trip records for January 2019, as CSV, from the DataTalksClub mirror. The TLC itself now publishes only Parquet. Zone lookup: TLC taxi zones.
SQL grants through dedicated Redis Software ACLs¶
Use a native Redis ADBC driver that supports adbc.redis.rbac and follow its
dedicated ACL provisioning and recovery guide.
Users of a bound role must have a single Redis role; mixed-role users are
rejected by the initial driver mapping. Roles and users are provisioned by an
administrator. This adapter never changes
role membership. Provide the write-only management JSON through a secret profile
value; do not commit management credentials:
driver_options:
adbc.redis.rbac: "{{ env_var('DBT_ENV_SECRET_REDIS_RBAC') }}"
A table or incremental model can then use:
{{ config(materialized='incremental', grants={'select': ['analyst']}) }}
select 42 as id
Each grantee is quoted and sent in a separate statement. Existing grants are
read from information_schema.role_table_grants and compared with the model's
configuration; an unchanged incremental run sends no redundant grant.
Set grants={'select': []} on an existing incremental model to revoke managed
SELECT grants. An absent/empty grants configuration follows dbt's normal no-op
behavior. Unsupported privileges fail explicitly when RBAC is enabled. Base
tables only; the driver rejects views, PUBLIC, grant options and other object
kinds. Without adbc.redis.rbac, the adapter continues to warn and skip grants.
Flight SQL does not enable this native management path.
The driver manages only its dedicated ACL contribution. Other roles/ACLs may still permit reads after revoke. Enforcement propagation, prefix-changing DDL, metadata visibility, interrupted-write locks and recovery follow the driver's contract. Grants do not make dbt writes transactional.
An opt-in end-to-end test is in
adapter/tests/integration/test_rbac_grants.py. In an isolated Software database,
provision the dedicated role/ACL/reader first and set REDIS_URI,
REDIS_ADBC_DRIVER, SSL_CERT_FILE, REDIS_RBAC_TEST_CONFIG (management JSON),
REDIS_RBAC_TEST_ROLE, and REDIS_RBAC_TEST_READER_URI. Run it sequentially:
python -m pytest adapter/tests/integration/test_rbac_grants.py -q