Skip to content

To use AI tools in an analytics workflow, give an AI assistant the work it can do from text you supply, and keep the checks that need the warehouse for yourself. AI tools for analytics engineers are useful for drafting SQL from a clear specification, explaining an unfamiliar query, writing column descriptions, proposing tests, and drafting the description of a pull request, the proposed code change a teammate reviews. The grain of each table, the join keys, and the business definitions have to come from you, and every result has to be run and reconciled before anyone relies on it.

Where an AI assistant helps and where it needs a human check

An AI assistant here means a tool built on a large language model (defined below) that returns text or code in response to a written request, called a prompt. It knows only what is in the prompt and in whatever files or data it is connected to. That usually leaves out the grain of a table (what one row represents), the safe join keys, and what a term such as "active customer" means at your company.

TaskHow much to rely on an assistantWhat to check
Draft SQL from a written specificationFor a first draftRun it, compare row counts across each join, and reconcile a total
Explain an unfamiliar queryAs a starting pointRead it against the code and run the query in pieces
Write column descriptionsFor wording, not meaningIt matches how the column is calculated, including units and nulls
Propose testsFor a list of candidatesKeep tests that state an agreed rule. Confirm each can fail
Draft a pull request descriptionFor the summary of what changedIt matches the change. Add the reason, which the assistant does not know
Choose a grain, join key, or metric definitionDo not delegateAgree on it with the people who own the data
State a fact about your dataNot unless the tool ran a queryRun the query yourself

AI tools analytics engineers are likely to meet

Each is described as its vendor's documentation described it on 2026-11-22. This is not a ranking or a recommendation.

  • dbt Wizard. dbt builds warehouse tables and views from SQL SELECT statements. Its documentation calls dbt Wizard the AI agent in the dbt platform, marked Preview when read. Listed uses include generating documentation and tests, building or refactoring models from plain-language prompts, and reviewing proposed file changes before they are saved.
  • Gemini in BigQuery. Google documents generating SQL and Python, explaining an existing SQL query, and data insights generated from table metadata. Its SQL generation tips say column descriptions are taken into account. Google warns that output can seem plausible and be factually incorrect, and recommends validating all of it.
  • Snowflake Cortex AI Functions. SQL functions that run a large language model over text or images, such as AI_CLASSIFY and AI_SENTIMENT. They apply a model to data rather than write your SQL. Some are marked as preview features.
  • GitHub Copilot. GitHub describes an AI assistant that suggests code as you type, answers questions about a codebase, and reviews changes. It can write a pull request summary. GitHub says to review that summary carefully and to validate generated code the way you would review a colleague's work.

How to verify the output: a worked review

Four checks, in order: run it, reconcile a total against a number you trust, compare row counts before and after each join, and save the check as a test. PostgreSQL 16 stands in for the warehouse, with one row per order in orders and one row per order line in order_items.

create table orders (
    order_id    integer primary key,
    customer_id integer,
    order_total numeric(10, 2)
);

create table order_items (
    order_id    integer references orders (order_id),
    line_number integer,
    quantity    integer,
    primary key (order_id, line_number)
);

insert into orders values
    (1, 101, 120.00),
    (2, 101,  80.00),
    (3, 102, 200.00),
    (4, 103,  50.00);

insert into order_items values
    (1, 1, 1), (1, 2, 2),
    (2, 1, 1),
    (3, 1, 1), (3, 2, 1), (3, 3, 4),
    (4, 1, 1);

The request is "revenue and units sold per customer". Treat this query as a draft to review, whoever wrote it. It runs and returns the requested columns.

select
    o.customer_id,
    sum(o.order_total) as revenue,
    sum(i.quantity)    as units
from orders as o
join order_items as i on i.order_id = o.order_id
group by o.customer_id
order by o.customer_id;

 customer_id | revenue | units 
-------------+---------+-------
         101 |  320.00 |     4
         102 |  600.00 |     6
         103 |   50.00 |     1
(3 rows)

Customer 103 is correct, so a spot check of that row would pass. But the revenue column adds up to 970.00, and the source table disagrees:

select sum(order_total) as known_revenue from orders;

 known_revenue 
---------------
        450.00
(1 row)

orders has four rows. Count the rows after the join:

select count(*) as rows_after_join
from orders as o
join order_items as i on i.order_id = o.order_id;

 rows_after_join 
-----------------
               7
(1 row)

The join returns one row per order line, so order_total is counted twice for order 1 and three times for order 3. This is a fan-out: a one-to-many join repeats the row on the "one" side (see SQL joins explained). The fix is to aggregate order_items to one row per order before joining.

create view customer_revenue as
with units_per_order as (
    select order_id, sum(quantity) as units
    from order_items
    group by order_id
)
select
    o.customer_id,
    sum(o.order_total) as revenue,
    sum(u.units)       as units
from orders as o
join units_per_order as u on u.order_id = o.order_id
group by o.customer_id;

select * from customer_revenue order by customer_id;

 customer_id | revenue | units 
-------------+---------+-------
         101 |  200.00 |     4
         102 |  200.00 |     6
         103 |   50.00 |     1
(3 rows)

Revenue now adds up to 450.00. Save the reconciliation as a test, a query that returns a row only when something is wrong:

select 'revenue does not reconcile' as failure
where (select sum(revenue) from customer_revenue)
   <> (select sum(order_total) from orders);

 failure 
---------
(0 rows)

Run against the draft's logic, the same test returns one row. dbt calls this a singular data test: a SELECT that returns failing rows and passes when it returns none. See the guide to testing in dbt, and CI/CD for analytics projects for running tests on every pull request.

What to put in a prompt

The one-line request left out the fact that mattered: the order total is stored once per order. Give the assistant what a new teammate would need:

  • The SQL dialect and version.
  • Table and column names, with types.
  • The grain and key of each table.
  • The expected output: one row per what, and which columns.
  • One example row.
  • Business definitions in plain words.

A worked prompt for the same request:

Write one PostgreSQL 16 query.

Tables:
- orders: one row per order. order_id integer (primary key),
  customer_id integer, order_total numeric(10,2).
- order_items: one row per order line. order_id integer,
  line_number integer, quantity integer.
  Primary key (order_id, line_number).

Return one row per customer: customer_id, revenue (sum of
order_total), units (sum of quantity). order_total is stored once
per order, so do not sum it after a join to order_items.

Example: customer 101 has orders of 120.00 and 80.00 with 4 units,
so the row is 101, 200.00, 4.

For dbt work, also name the models to select from and the tests you expect. GitHub's prompt guidance adds: state the goal first, give examples, and split large tasks. Google's Machine Learning Glossary names the techniques: zero-shot prompting gives no example of the response you want, few-shot prompting gives several, and chain-of-thought prompting asks the model to explain its reasoning step by step. A complete prompt does not replace the checks.

What not to paste into an AI tool

Do not paste customer rows, personal data, passwords, API keys, or connection strings into a tool your company has not approved. A prompt rarely needs them: the one above uses names, types, grain, and an invented row. Before using a tool with company data, read its data-use terms: what it can access, whether prompts are stored, and whether they are used to train models. For example, Google's overview of Gemini in BigQuery, read on 2026-11-22, states that enabling it grants access to your tables and query history, and that Gemini in BigQuery does not use your data to train or fine-tune its models. Terms differ by vendor and plan, so read the current ones.

Machine learning terms worth knowing

These definitions follow Google's Machine Learning Glossary.

  • Training data. The examples a machine learning model learns from, so that it can make predictions about data it has not seen. Part of the dataset is held back to validate and test the model.
  • Features. The input variables of a model. In a warehouse, usually a column, such as a customer's 90-day order count.
  • Supervised versus unsupervised learning. Supervised learning trains on features paired with a label, the known answer, such as whether a customer churned. Unsupervised learning finds patterns in unlabeled data, most often by clustering similar rows into groups.
  • Large language model (LLM). A language model with a very large number of parameters, the values a model learns in training. A language model estimates how likely a sequence of tokens (words or pieces of words) is. Nothing in that process checks the output against your warehouse, so an LLM can produce fluent SQL that is wrong. The glossary calls plausible but incorrect output a hallucination.

What analytics engineers contribute to machine learning work

Our advice: treat a table that feeds a model like any other table you publish. Declare its grain, such as one row per customer per day, document every column, and test the keys. A training set built on a fan-out has the same fault as the draft above and is harder to notice. These are the habits used for fact and dimension tables.

How AI changes the analytics engineer's job

This is this site's judgment, not a forecast. A first draft of a query or a description is now cheap. Deciding whether it is right is not. We expect the work that matters most to be what an assistant cannot do from a prompt: choosing the grain of a model, agreeing on a definition with the people who use the number, writing the tests that prove a result, and reviewing changes. Those were already the core of analytics engineering. To practice review, use the practice exercises, which grade your SQL, and the datasets, which give you tables to test a draft against.

Common mistakes

  • Accepting a query because it runs. The draft above ran and returned the right columns.
  • Spot-checking one row. Customer 103 was correct. The total was not.
  • Leaving the grain out of the prompt. The assistant has to guess what one row is.
  • Publishing generated tests and descriptions unread. A test that cannot fail and a fluent description of the wrong calculation both do harm.

Frequently Asked Questions

What steps should be followed to effectively apply AI within data analytics?

Start with one task where a draft is easy to check, such as a query against tables you know. State the dialect, tables, grain, and expected output in the prompt. Run the result, compare row counts across each join, and reconcile a total. Then save the check as a test and have a person review the change.

What are the best practices for prompt engineering in analytics work?

State the dialect, the tables and columns with types, each table's grain and key, the expected output, and one example row. Define business terms in words. Treat the answer as a draft to run and check.

What machine learning concepts should analytics engineers understand?

Enough to follow a conversation with a data scientist: training data, features, labels, supervised versus unsupervised learning, and what a large language model is. The more useful contribution is a documented, tested table with a declared grain.

How is generative AI changing the role of analytics engineers?

In this site's judgment, it makes first drafts cheap and review more important. The skills an assistant cannot supply from a prompt are choosing a grain, agreeing on definitions, testing, and checking a result against the warehouse.

Primary sources and further reading

The SQL in this article was run on PostgreSQL 16, and the output shown is what it returned. Vendor pages were read on 2026-11-22.