Meltano provides a command line interface (CLI) that allows you to manage the configuration and orchestration of Meltano instances. It provides a single source of truth for the entire data pipeline. The CLI makes it easy to develop, run, and debug every step of the data life cycle.
addThe add command allows you to add an extractor, loader, or transform to your Meltano instance.
When you add a extractor or loader to a Meltano instance, Meltano will:
meltano.yml file.meltano directory with venv and pip# Extractor / Loader Template
meltano add [extractor | loader] [name_of_plugin]
# Extractor Example
meltano add extractor tap-gitlab
# Loader Example
meltano add loader target-postgres
When you add a transform to a Meltano instance, Meltano will:
meltano.yml file# Transform Template
meltano add [transform] [name_of_transform]
When you add a model to a Meltano instance, Meltano will:
meltano.yml file to help you interactively generate SQL.meltano directory which are then available to use in the Meltano webappmeltano add model [name_of_model]
When you add an orchestrator to a Meltano instance, Meltano will:
meltano add orchestrator [name_of_orchestrator]
configEnables you to change a plugin's configuration.
Meltano uses configuration layers to resolve a plugin's configuration:
config: attribute in meltano.ymlmeltano config or in the UI (stored in the system database)Sensitive settings such as passwords or keys should not be configured using meltano.yml,
since the entire contents of this file are available to the Meltano UI and its users.
Instead, these sensitive values should be stored in environment variables, or the system database (using meltano config or the UI).
You can use meltano config <plugin_name> list to find the environment variable associated with a setting.
Note that in each of these cases, Meltano stores the configuration as-is, without encryption.
# Displays the plugin's configuration.
meltano config <plugin_name>
# List the available settings for the plugin.
meltano config <plugin_name> list
# Sets the configuration's setting `<name>` to `<value>`.
meltano config <plugin_name> set <name> <value>
# Remove the configuration's setting `<name>`.
meltano config <plugin_name> unset <name>
# Clear the configuration (back to defaults).
meltano config <plugin_name> reset
discoverLists the available plugins you are interested in.
# List all available plugins
meltano discover all
# Only list available extractors
meltano discover extractors
# Only list available loaders
meltano discover loaders
# Only list available models
meltano discover models
eltThis allows you to run your ELT pipeline to Extract, Load, and Transform the data with configurations of your choosing:
job_id is autogenerated using the current date and time if it is not provided (via --job_id or $MELTANO_JOB_ID)run_id is a UUID autogenerated at each run.meltano/run/elt/{job_id}/{run_id}/elt.logmeltano elt <extractor> <loader> [--job_id TEXT] [--transform run] [--dry]
The --transform option can be:
run: run the Transformsskip: skip the Transforms (Default)only: only run the Transforms (skip the Extract and Load steps)meltano select --exclude tap-carbon-intensity '*' 'longitude'
meltano select --exclude tap-carbon-intensity '*' 'latitude'
This will exclude all longitude and latitude attributes.
extractExtract data to a loader and optionally transform the data
meltano extract [name of extractor] --to [name of loader]`
initUsed to create a new meltano project with a basic infrastructure in place in the current directory that the user is in.
# Format
meltano init [project_name] [--no_usage_stats]
installInstalls all the dependencies of your project based on the meltano.yml file.
meltano install
invokemeltano invoke <plugin_name> PLUGIN_ARGS...: Invoke the plugin manually.listUse --list to list the current selected tap attributes.
Note:
--allcan be used to show all the tap attributes with their selected status.
permissionsThis is an optional tool for users who want to configure permissions if they're using Snowflake as the data warehouse and want to granularly set who has access to which data at the warehouse level.
Alpha-quality Role Based Access Control (RBAC) is also available.
Use this command to check and manage the permissions of a Snowflake account.
meltano permissions grant <spec_file> --db snowflake [--dry] [--diff] [--full-refresh]
Given the parameters to connect to a Snowflake account and a YAML file (a "spec") representing the desired database configuration, this command makes sure that the configuration of that database matches the spec in an additive manner. If there are differences, it will return the sql grant and revoke commands required to make it match the spec. If there are additional permissions set in the database this command will not create the necessary revoke commands with the exception of:
We currently support only Snowflake, as pgbedrock can be used for managing the permissions in a Postgres database.
The YAML specification file is used to define in a declarative way the databases, roles, users and warehouses in a Snowflake account, together with the permissions for databases, schemas and tables for the same account.
Its syntax is inspired by pgbedrock, with additional options for Snowflake.
All permissions are abbreviated as read or write permissions, with Meltano generating the proper grants for each type of object. This includes shared databases which have simpler and more limited permissions than non-shared databases.
Tables and views are listed under tables and handled properly behind the scenes.
If * is provided as the parameter for tables the grant statement will use the ALL <object_type>s in SCHEMA syntax. It will also grant to future tables and views. See Snowflake documenation for ON FUTURE
If a schema name includes an asterisk, such as snowplow_*, then all schemas that match this pattern will be included in grant statement. This can be coupled with the asterisk for table grants to grant permissions on all tables in all schemas that match the given pattern. This is useful for date-partitioned schemas.
All entities must be explicitly referenced. For example, if a premission is granted to a schema or table then the database must be explicitly referenced for permissioning as well.
A specification file has the following structure:
# Databases
databases:
- db_name:
shared: boolean
- db_name:
shared: boolean
... ... ...
# Roles
roles:
- role_name:
warehouses:
- warehouse_name
- warehouse_name
...
member_of:
- role_name
- role_name
...
privileges:
databases:
read:
- database_name
- database_name
...
write:
- database_name
- database_name
...
schemas:
read:
- database_name.*
- database_name.schema_name
- database_name.schema_partial_*
...
write:
- database_name.*
- database_name.schema_name
- database_name.schema_partial_*
...
tables:
read:
- database_name.*.*
- database_name.schema_name.*
- database_name.schema_partial_*.*
- database_name.schema_name.table_name
...
write:
- database_name.*.*
- database_name.schema_name.*
- database_name.schema_partial_*.*
- database_name.schema_name.table_name
...
owns:
databases:
- database_name
...
schemas:
- database_name.*
- database_name.schema_name
- database_name.schema_partial_*
...
tables:
- database_name.*.*
- database_name.schema_name.*
- database_name.schema_partial_*.*
- database_name.schema_name.table_name
...
- role_name:
... ... ...
# Users
users:
- user_name:
can_login: boolean
member_of:
- role_name
...
- user_name:
... ... ...
# Warehouses
warehouses:
- warehouse_name:
size: x-small
... ... ...
For a working example, you can check the Snowflake specification file that we are using for testing meltano permissions.
The database to be used, either postgres or snowflake. Postgres is still experimental and may be fully supported in the future.
When this flag is set, a full diff with both new and already granted commands is returned. Otherwise, only required commands for matching the definitions on the spec are returned.
When this flag is set, the permission queries generated are not actually sent to the server and run; They are just returned to the user for examining them and running them manually.
Currently we are still evaluating the results generated by the meltano permissions grant command, so the --dry flag is required.
When this flag is set, the permission queries generated are revoke statements for all roles, warehouse, databases, schemas, and tables listed in the spec file. Currently it will not revoke ownership of database objects or disable users. The revoke commands are run prior to the grant commands.
The following environmental variables must be available to connect to Snowflake:
$PERMISSION_BOT_USER
$PERMISSION_BOT_PASSWORD
$PERMISSION_BOT_ACCOUNT
$PERMISSION_BOT_DATABASE
$PERMISSION_BOT_ROLE
$PERMISSION_BOT_WAREHOUSE
scheduleTIP
An orchestrator plugin is required to use meltano schedule: refer to the Orchestration documentation to get started with Meltano orchestration.
Meltano provides a schedule method to run specified ELT pipelines at regular intervals. Schedules are defined inside the meltano.yml project as such:
meltano schedule <schedule_name> <extractor> <loader> <interval> [--transform]: Schedule an ELT pipeline to run using an orchestrator.
meltano schedule list: List the project's schedules.schedules:
- name: test
interval: '@daily'
extractor: tap-mock
loader: target-mock
transform: skip
env: {}
selectUse the select command to add select patterns to a specific extractor in your Meltano project.
meltano select [--list] [--all] <tap_name> [ENTITIES_PATTERN] [ATTRIBUTE_PATTERN]: Manage the selected entities/attributes for a specific tap.WARNING
Not all taps support this feature. In addition, taps needs to support the --discover switch. You can use meltano invoke tap-... --discover to see if the tap supports it.
Meltano select patterns are inspired by the glob syntax you might find in your operating system.
*: matches any sequence of characters?: matches one character[abc]: matches either a, b, or c[!abc]: matches any character but a, b, or c$ meltano select tap-carbon-intensity '*' 'name*'
This will select all attributes starting with name.
$ meltano select tap-carbon-intensity 'region'
This will select all attributes of the region entity.
TIP
Most shells parse glob syntax: you must escape the special characters in the select pattern by quoting the pattern.
Use --exclude to exclude all attributes that match the filter.
Exclusion has precedence over inclusion. If an attribute is excluded, there is no way to include it back without removing the exclusion pattern first.
uimeltano ui: Start the Meltano UI.start (default)Start the Meltano UI.
setupTIP
This command is only relevant for production-grade setup.
Generate secure secrets in the ui.cfg so that the application is secure.
WARNING
Regenerating secrets will cause the following:
Use with caution!
Specify the size of the secrets, default to 256.
userTIP
This command is only relevant when Meltano is run with authentication enabled.
addCreate a Meltano user account, active and ready to be used.
Update the user instead of creating a new one.
Add the user to the role. Meltano ships with two built-in roles: admin and regular.
meltano user add admin securepassword --role admin
upgradeUpgrade Meltano to the latest version.
This function will following process to upgrade Meltano:
pip3 install --upgrade meltano.meltano/run/gunicorn.pid, thus restarting the workersversionIt is used to check which version of Meltano currently installed.
meltano --version