Engineering

Migrating dbt to HatiData in 5 Minutes

HatiData Team4 min read

Zero SQL Changes Required

The biggest fear when migrating off a legacy cloud warehouse is the SQL rewrite. Thousands of dbt models, hundreds of macros, years of tested logic — the idea of touching any of it is terrifying. With HatiData, you don't have to. Our AI-powered SQL transpiler handles dialect differences automatically, so your existing models run as-is.

Here's exactly how to do it.

Step 1: Install the dbt-hatidata Adapter

The HatiData dbt adapter is a drop-in replacement for your existing warehouse adapter. Install it alongside your current setup:

bash
pip install dbt-hatidata

That's it. The adapter speaks PostgreSQL wire protocol under the hood, which means it works with the same connection patterns your team already knows.

Step 2: Update Your profiles.yml

Add a HatiData target to your existing profiles.yml. You can keep your current warehouse target intact — this lets you run models against both platforms during migration:

yaml
my_project:
  target: hatidata
  outputs:
    hatidata:
      type: hatidata
      host: your-cluster.vpc.hatidata.com
      port: 5439
      user: dbt_runner
      password: "{{ env_var('HATIDATA_PASSWORD') }}"
      database: analytics
      schema: production
      threads: 8

Notice the port is 5439 — the standard Postgres-compatible port. Your firewall rules and security groups work exactly as they would with any Postgres connection.

Step 3: Run dbt build

With the adapter installed and the profile configured, run your models:

bash
dbt build --target hatidata

Behind the scenes, HatiData's AI transpiler intercepts any legacy warehouse SQL syntax — FLATTEN, LATERAL, QUALIFY, OBJECT_CONSTRUCT, colon notation for semi-structured data — and translates it to equivalent DuckDB-native SQL. If the transpiler encounters an edge case it can't handle deterministically, the AI healer kicks in to generate a correct translation.

Step 4: Compare Results

During migration, we recommend running models against both your existing warehouse and HatiData and comparing outputs. The Shadow Mode report automates this: it runs your dbt DAG against both platforms, compares row counts, checksums, and latency, and produces a compatibility matrix showing exactly which models passed and which need attention.

In our experience, 99%+ of dbt models run without any modification. The remaining edge cases are typically vendor-specific stored procedures or JavaScript UDFs, which the HatiData team can help migrate during onboarding.

Why This Works

HatiData is a purpose-built query engine backed by DuckDB and Apache Iceberg, with a SQL compatibility layer powered by AI transpilation. The transpiler understands the full SQL dialect of legacy cloud warehouses — including semi-structured data operations, window functions, and lateral joins — and produces optimized DuckDB queries that return identical results.

The dbt adapter handles connection management, materialization strategies, and incremental model support out of the box. If you can run dbt build today, you can run it on HatiData in 5 minutes.

Ready to see the difference?

Run the free audit script in 5 minutes. Or start Shadow Mode and see HatiData run your actual workloads side-by-side.