Docs

amfelt sql generate

Write out the generated SQL for this project.

Renders warehouse SQL for your selected objects and writes it under your project’s configured SQL directory (sql/ by default), nested <namespace>/<object>/ so an object’s SQL moves as one unit. An object with no primary key, or a job scoped to a layer that renders no SQL at all, contributes nothing — this matches what the pipeline actually runs, not just what was selected.

Rendering asks the target plugin this project is pinned to, so the result matches what actually runs, including any template you have customized. Doing so connects to your target using its configured connection details — nothing is executed against it, but the connection itself is real, not simulated.

A file carrying Amfelt’s marker is Amfelt’s: overwritten if this run still emits it, removed if it does not — even if you edited it in place, since editing a file does not remove its marker. Any other .sql file under your SQL directory is not ignored: it stops the command, because this generator cannot tell your unmarked file from one safe to write over. Only a file that is not .sql at all — a .gitkeep, a .DS_Store — is genuinely left alone.

Generation is opt-in: add a sql: block with enabled: true to your project file before running this command.

Usage  

amfelt sql generate [flags]

Examples  

sql generate
Writes the generated SQL for the project in the current directory.

sql generate --path pcf/PCF-duckdb.yaml
Writes it for the project defined by the given project file.

Flags  

FlagTypeDefaultDescription
--pathstringamfelt.yamlpath of the Amfelt project file

Global flags  

FlagTypeDefaultDescription
--amfelt-dirstring.amfeltdirectory for workspace files (such as plugins); does not move agent identity (controlled by AMFELT_DIR)
--configstring—directory or filename of the application configuration
-f, --formatstringdefaultlog format to use; either default, pretty, or json
-l, --levelstringinfominimum log level to display; either error, warn, info, or debug
-v, --verboseboolfalsetrigger to use verbose logging

See also  

  • sql — the parent command

Generated from amfelt v5.6.3.


Last updated on November 1, 2026