The Simplest Way to Make Gitea and dbt Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Running gitea and dbt together gives your data team version control and clean SQL pipelines. Gitea stores your project files, while dbt runs SQL models against your data warehouse. This pair helps teams test and deploy data changes with every code commit. You get clear review steps before any SQL query changes production tables. When teams set up both tools well, they ship clean data with less toil. How gitea and dbt handle logins and data flow Gitea acts as the central git server for all yo

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Running gitea and dbt together gives your data team version control and clean SQL pipelines. Gitea stores your project files, while dbt runs SQL models against your data warehouse.

This pair helps teams test and deploy data changes with every code commit. You get clear review steps before any SQL query changes production tables. When teams set up both tools well, they ship clean data with less toil.

How gitea and dbt handle logins and data flow

Gitea acts as the central git server for all your SQL models and tests. Data analysts push code changes to a branch and open a pull request. This action triggers a runner job that starts the dbt build process.

First, the runner uses a deploy key or token to read the Gitea repo. Next, dbt compiles your model files into raw SQL queries for the database. Then dbt logs in to your data warehouse using a service account role.

No actual warehouse table data flows back into the Gitea server. Instead, dbt sends SQL commands to the database and reads back status logs. The database does all the heavy work and stores the final tables. Gitea only holds the text files, test rules, and run status updates.

Common risks with shared keys and broad roles

Many teams take shortcuts when they first link their git server and SQL runner. A common mistake is putting one static database admin key into Gitea runner secrets. Every job and every user then shares that single powerful database login.

If that key leaks, an attacker can read or drop all your production tables. Shared accounts also ruin your database audit logs. Every query in the warehouse log shows the same generic runner account name. You cannot tell which team member wrote or ran a bad query.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Broad git tokens create another big risk for your data team. If a runner token has write rights across Gitea, a bad script can change code. It could push fake SQL models to other repos on your server.

Local developer laptops bring even more risk to this setup. Analysts often run dbt from their own machines to test code changes fast. To do this, they store warehouse keys in plain text files on their disks. They also get broad read rights to production tables full of private customer data.

Scoping roles and network paths for safer runs

You can fix these risks by splitting roles and tightening network paths. Start by giving your Gitea runner a read-only deploy key for one repo. The runner only needs to pull code, not push changes back to git.

Next, split your database roles by job type. Give pull request checks a weak role that only writes to a test schema. Keep the production write role locked to the main branch runner job. Rotate the keys for both roles on a strict schedule.

For local tests, do not give analysts direct keys to production data tables. Let them run models against small, safe test datasets instead. If queries touch live tables, use data masking to rewrite emails and card numbers. Also, lock down your database firewall so only known runner IPs can reach it.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Does Gitea store any of my raw warehouse data during a dbt run?

No, Gitea only stores your SQL model files and project settings. The data stays inside your warehouse while the runner sends queries to it.

How should developers test dbt models without using production database keys?

Give each developer a separate test schema with fake or masked data. Never put live production passwords in local text files on user laptops.

Why do database logs show the same user for all our pipeline runs?

This happens when your CI jobs all share one static database service account. You must map runs to individual identities or separate job roles to fix the logs.

The query runs. The emails stay hidden.