The Analytics Engineer exam checks whether you correctly understand per-adapter connection definitions (profiles.yml) and the local validation flow. This article uses the Postgres adapter to summarize a basic setup that reliably works and the tips you need so your sanity checks do not fail.
The content is based on the stable specifications from the official documentation and is narrowed down to a form you can use as-is in production work.
dbt-postgres is the official adapter that deploys dbt models (SELECTs) as tables or views on PostgreSQL and runs tests against them. The connection is defined in profiles.yml, and CLI commands such as dbt run and dbt test are identical to those for other adapters.
From an exam perspective, expect questions on type: postgres, the main keys (dbname, schema, threads), the connection check command (dbt debug), and externalizing secrets via env_var.
Install and version check (example: Unix-style shell)
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install dbt-postgres
dbt --versionFor local validation, running Postgres in Docker is both safe and reliable. Prepare a dedicated database and schema for development and grant the dbt user creation privileges. Use the default port 5432.
Once it is up, verify the connection with psql to make problem isolation easier. Before involving dbt, confirm that you can connect to the database itself.
Local validation topology
docker-compose.yml (minimal example)
version: '3.8'
services:
postgres:
image: postgres:15
container_name: pg_local
environment:
POSTGRES_USER: dbt
POSTGRES_PASSWORD: dbtpass
POSTGRES_DB: analytics
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:dbt reads ~/.dbt/profiles.yml (or the path pointed to by the DBT_PROFILES_DIR environment variable) to resolve connection information. For Postgres, dbname and schema are the key fields, and it is safest to separate schemas per target.
Externalize secrets with env_var. Keep threads modest based on your development machine. Add optional keys such as sslmode according to your requirements.
~/.dbt/profiles.yml (example, using environment variables)
nicheelab_project:
target: dev
outputs:
dev:
type: postgres
host: {{ env_var('PGHOST', 'localhost') }}
user: {{ env_var('PGUSER', 'dbt') }}
password: {{ env_var('PGPASSWORD', 'dbtpass') }}
port: {{ env_var('PGPORT', '5432') | int }}
dbname: {{ env_var('PGDATABASE', 'analytics') }}
schema: analytics_dev
threads: 4
search_path: public
sslmode: preferMatch the project name and the profile name, then add a minimal model and test under models. Using seeds lets you load test data without external dependencies, which makes local validation stable.
On Postgres, each model basically runs inside a transaction and is rolled back on failure. Choose view or table for materialized as needed.
Minimal layout (multiple files shown together)
# dbt_project.yml
name: 'nicheelab_project'
profile: 'nicheelab_project'
version: '1.0.0'
model-paths: ['models']
seed-paths: ['data']
models:
nicheelab_project:
+materialized: view
seeds:
nicheelab_project:
+schema: analytics_dev
# data/customers.csv
id,name
1,Alice
2,Bob
# models/stg_customers.sql
select
cast(id as integer) as customer_id,
name
from {{ ref('seed_customers') }}
# models/schema.yml
version: 2
seeds:
- name: customers
config:
alias: seed_customers
models:
- name: stg_customers
columns:
- name: customer_id
tests:
- not_null
- uniqueFirst, run dbt debug to verify the profile and the connection. Next, load the CSV with dbt seed, deploy the models with dbt run, and execute the tests with dbt test. To do everything in one go, dbt build is convenient.
Use --profiles-dir to switch the profile location. Insufficient privileges (no CREATE SCHEMA) and connection refusals (wrong port or host) become obvious at this stage.
Common commands (Unix-style shell)
# 接続確認
dbt debug
# シードをロード
dbt seed
# モデルを実行(ビュー/テーブル作成)
dbt run
# テストを実行
dbt test
# すべてを順序よく一括実行
dbt build
# プロファイルの場所を明示する場合
dbt debug --profiles-dir ./profilesConnection keys and concepts differ slightly between adapters. Postgres revolves around dbname and schema; concepts like warehouses or role switching do not appear. Snowflake and Databricks have different required keys and authorization models, so on the exam you want to know the minimum differences between each adapter.
What matters across all adapters is the correct type in profiles.yml, externalizing secrets via env_var, pre-validating with dbt debug, and separating schemas per target.
| Adapter | Main connection keys | Auth and connection essentials | Required / representative profile keys |
|---|---|---|---|
| Postgres (dbt-postgres) | DB (dbname) / schema | Direct TCP (5432). User / password | type, host, user, password, port, dbname, schema, threads |
| Snowflake (dbt-snowflake) | Account / DB / schema / warehouse | User / password or key pair. Switch privileges with roles | type, account, user, password, role, warehouse, database, schema |
| Databricks (dbt-databricks) | Workspace / catalog / schema | HTTP(S). Personal Access Token plus host / http_path | type, host, http_path, token, catalog, schema |
Switching targets (temporarily build against prod)
# profiles.ymlのtargetを変更せずに一時上書き
dbt build --target prodAnalytics Engineer
問題 1
When running local validation with dbt-postgres, which key in profiles.yml is both required and specific to Postgres?
正解: A
For the Postgres adapter, dbname (the target database) is required. warehouse is a Snowflake key, http_path is a Databricks key, and account is a primary key for Snowflake.
Where should profiles.yml be placed? Can it live inside the project?
The default location is ~/.dbt/profiles.yml under your home directory. To put it inside the project or another directory, point DBT_PROFILES_DIR to that path or pass --profiles-dir on the command line.
What should I do when dbt fails because it cannot auto-create the schema?
The connecting user needs CREATE privileges on the target database. Ask your DB administrator to grant CREATE on that database, or to pre-create the target schema.
How do I configure SSL?
Add an sslmode entry to the connection settings in profiles.yml (for example, require or verify-ca). Match your target's policy, and place certificates correctly in the environment when required.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
dbt Models: SQL-Defined Transformation Units (2026)
Model fundamentals — SELECT-based definitions, naming, refs,...
dbt Analytics Engineering Exam: Complete Guide (2026)
Pass the AE Certification — scope, weighting, sample questio...
dbt Cloud vs dbt Core: Feature & Cost Comparison (2026)
Honest comparison of dbt Cloud vs. dbt Core — IDE, scheduler...
dbt Project Structure: models/seeds/macros Layout (2026)
Recommended dbt project layout — models, seeds, macros, snap...
dbt_project.yml Explained: Every Config (2026)
Every dbt_project.yml setting that matters — paths, vars, ma...