Kafka SQL Connector

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a kafka sql connector by linking your database to an event worker. This worker reads table changes or writes stream events into your database tables. Teams often use a single shared database account to run these data jobs. If that shared role has broad permissions, one bad job can change any table. A stray query or broken stream task can also pull sensitive rows into public topics. How a kafka sql connector works in practice A kafka sql connector runs inside a cluster of worker nod

SQL Query Filtering: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

You set up a kafka sql connector by linking your database to an event worker. This worker reads table changes or writes stream events into your database tables. Teams often use a single shared database account to run these data jobs. If that shared role has broad permissions, one bad job can change any table. A stray query or broken stream task can also pull sensitive rows into public topics.

How a kafka sql connector works in practice

A kafka sql connector runs inside a cluster of worker nodes that move data. Source jobs pull rows from database tables and turn them into event messages. They check a timestamp column or an auto-incrementing key to find new rows. Some teams use log-based change tools to read the database write log instead. Log tools catch every insert, update, and delete without running heavy table queries.

Sink jobs do the reverse work for your data team. They read messages from topics and run insert or update commands on the database. The worker holds the database user name and password in its own job file. Each task opens a database session and runs SQL statements on a steady timer. You can scale the job up by adding more parallel tasks to the worker.

Choosing between query pollers and log readers

Teams must choose between polling tables with queries or reading the internal database log. Polling is simple to set up because it uses standard SQL select statements. Still, polling puts extra load on the database when tables grow very large. It can also miss row deletes unless you mark rows with a soft flag. Log readers avoid extra query load by reading binary change files from the disk.

Log readers require deeper database permissions to read internal system replication streams. Database admins often push back when a worker asks for full replication rights. If you grant those rights, the worker can read changes across the whole database. Teams must weigh ease of setup against the wide scope of replication roles.

SQL Query Filtering: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native connector roles solve and where they fall short

Native database roles let you pick which tables the worker account can read or write. You can create a dedicated user role just for your stream worker nodes. You can also store the database password in an external secret store for safety. This setup stops random apps on your network from logging into the database.

Still, native setup only checks who logs in when the session first starts. It does not inspect what individual SQL statements or stream tasks do in flight. If an engineer edits a job file, that worker uses the same broad role. A source job might pull emails, phone numbers, card numbers, or national IDs into topics. Native roles cannot rewrite matched fields in results before they enter the event stream. You also lack a clear log linking job changes to specific database queries.

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 sits inline in the protocol beside each supported service as an open-source proxy, a sidecar for your database or API. For every query or command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.

First, hoop.dev guardrails block banned queries before they run or hold risky ones for review, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

What is the difference between a source connector and a sink connector?

A source job reads rows from a database and sends them to event topics. A sink job reads messages from topics and writes them into database tables.

How do we stop a kafka sql connector from leaking sensitive columns?

Restrict the database role to specific views, or use data masking on query results. Masking rewrites matched fields like emails and card numbers before the worker reads them.

Why do database admins dislike shared worker credentials?

Shared keys make it impossible to see which person or job ran a bad query. Admins cannot revoke one broken job without stopping every other task using that key.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.