Docs

amfelt import

Create a data contract for a given source.

Creates a data contract for a source identified by a connection string (URL). Supported URLs are of the form: protocol+transport://user:pass@host/dbname?opt1=a&opt2=b protocol:/path/to/file

Supported URL components: protocol: name of the driver. transport: either ’tcp’, ‘udp’, ‘unix’ or driver name (odbc/oleodbc). dbname*: database, instance, or service name/ID to connect to. ?opt1=…: additional database driver options.

  • For Microsoft SQL Server, /dbname can be /instance/dbname, where /instance is optional. For Oracle Database, /dbname is of the form /service/dbname where /service is the service name or SID, and /dbname is optional.

The contract is saved as contracts/<name>.odcs.yaml next to the project file, the file commit pushes with amfelt.yaml. --folder saves it in another directory instead, and commit then refuses the project until the file is moved to contracts/.

Connecting to the source and reading its schema must finish within the import timeout, 2m by default. Set the AMFELT_IMPORT_TIMEOUT environment variable to a Go duration, such as 10m or 1h, to change it. An unset, invalid or non-positive value uses the default.

Usage  

amfelt import [name] [connection url] [flags]

Examples  

import adventureworks postgres://localhost:5432/Adventureworks?sslmode=disable
Imports the AdventureWorks database from a local Postgres database on port 5432.

import localfile sqlite:/localfile.db?loc=auto --force
Imports a local SQLite file. Existing project files and data contracts are
overwritten.

Flags  

FlagTypeDefaultDescription
--abbreviationstring—short source identifier for DWH naming convention (e.g. ‘adw’ for adventureworks)
--annotatedboolfalseinclude detailed type annotations (precision, scale, timezone, etc.) in the contract
--folderstringcontractsdirectory to save the contract in, relative to the project file (commit pushes only contracts/)
--forceboolfalseignore warnings and errors
--installboolfalseautomatically install the required plugins
--namespacestring—source namespace to interact with (comma-separated for multi-schema; ‘all’ for all schemas)
--pathstringamfelt.yamlpath of the Amfelt project file
--schema-abbrevstring—explicit schema abbreviations as key=value pairs (e.g. humanresources=hr,production=prod)
--secret-refstring—vault reference path for credentials (e.g. development/database/<project-id>/my-db); skips inline credentials

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

Generated from amfelt v5.6.3.


Last updated on November 1, 2026