amsdal
¶
AMSDAL CLI - a tool that provides the ability to create a new app, generate models, transactions, build, serve, and other useful features for the efficient building of new apps using AMSDAL Framework.
Args: ctx (typer.Context): The Typer context object. version (bool, optional): If True, check and show versions of AMSDAL packages. Defaults to False.
Returns: None
Usage:
$ amsdal [OPTIONS] COMMAND [ARGS]...
Options:
-v, --version
: Check and show versions of amsdal packages--help
: Show this message and exit.
Commands:
new, n
: Generates a new AMSDAL application.verify, vrf, v
: Verifies all application's files such as...build, bld, b
: Builds the app and generates the models...clean, cln
: Cleans project's folder by removing all...serve, srv, s
: Starts a test FastAPI server based on your...restore, rst
: Restores either models or state database...ci-cd
: Generates CI/CD pipeline files for...tests, test
: Runs tests with the specified database...register-connection, reg-conn
: Registers and adds a new connection to the...generate, gen, g
: Generates application's files such as...cloud, cld
: Commands to interact with the Cloud Server.migrations, migs, mgs
: Commands to manage migrations.worker, w
: Commands to run worker.
amsdal new, n
¶
Generates a new AMSDAL application.
Example:
amsdal new MyApplication .
It will create my_application
directory in the current directory with AMSDAL project.
Usage:
$ amsdal new, n [OPTIONS] APP_NAME OUTPUT_PATH
Arguments:
APP_NAME
: The Application name. For example: MyApplication [required]OUTPUT_PATH
: Output path, where the app will be created. [required]
Options:
--models-format [json|py]
: The format of models used in this app. [default: py]--async
: Whether to run the application in async mode.--help
: Show this message and exit.
amsdal verify, vrf, v
¶
Verifies all application's files such as models, properties, transactions, etc.
Usage:
$ amsdal verify, vrf, v [OPTIONS]
Options:
--building / --no-building
: Do verify model building? [default: no-building]--help
: Show this message and exit.
amsdal build, bld, b
¶
Builds the app and generates the models and other files.
Usage:
$ amsdal build, bld, b [OPTIONS] [OUTPUT]
Arguments:
[OUTPUT]
: Path to output directory [default: .]
Options:
--config PATH
: Path to custom config.yml file--help
: Show this message and exit.
amsdal clean, cln
¶
Cleans project's folder by removing all generated files and optionally local database.
Example of usage:
-
Cleanup generated files without removing local database:
amsdal clean
-
Cleanup generated files and remove local database:
amsdal clean --remove-db
Usage:
$ amsdal clean, cln [OPTIONS] [OUTPUT]
Arguments:
[OUTPUT]
: Path to output directory [default: .]
Options:
-db, --remove-db
: Remove local database?--help
: Show this message and exit.
amsdal serve, srv, s
¶
Starts a test FastAPI server based on your app's models.
Usage:
$ amsdal serve, srv, s [OPTIONS]
Options:
--cleanup / --no-cleanup
: Cleanup the generated models, warehouse and files after stopping [default: cleanup]--remove-warehouse-on-cleanup / --no-remove-warehouse-on-cleanup
: Remove the warehouse directory on cleanup [default: no-remove-warehouse-on-cleanup]--config PATH
: Path to custom config.yml file--host TEXT
: Host to run the server on [default: 0.0.0.0]--port INTEGER
: Port to run the server on--auto-reload / --no-auto-reload
: Enable auto-reload of the server when files change [default: no-auto-reload]--apply-fixtures / --no-apply-fixtures
: Apply fixtures to the database [default: apply-fixtures]--help
: Show this message and exit.
amsdal restore, rst
¶
Restores either models or state database from the lakehouse.
Example of usage:
-
Restore models:
amsdal restore models --config config.yml
-
Restore state database:
amsdal restore state_db --config config.yml
Usage:
$ amsdal restore, rst [OPTIONS]
Options:
--restore-type [models|state_db]
: [default: models]--config PATH
: Path to custom config.yml file--help
: Show this message and exit.
amsdal ci-cd
¶
Generates CI/CD pipeline files for specified VCS. Currently supported VCS are GitHub.
Example of usage:
Generate CI/CD pipeline files for GitHub:
amsdal ci-cd
Usage:
$ amsdal ci-cd [OPTIONS] [OUTPUT]
Arguments:
[OUTPUT]
: Path to output directory [default: .]
Options:
--vcs [github]
: Version Control System [default: github]--help
: Show this message and exit.
amsdal tests, test
¶
Runs tests with the specified database execution type, state option, and lakehouse option.
Example usage:
-
Run tests on SQLite database:
amsdal tests
-
Run tests on PostgreSQL database:
amsdal tests --state-option postgres --lakehouse-option postgres
-
Run tests with lakehouse-only execution type:
amsdal tests --db-execution-type lakehouse_only
Usage:
$ amsdal tests, test [OPTIONS]
Options:
--db-execution-type [lakehouse_only|include_state_db]
: [default: include_state_db]--state-option [sqlite|postgres]
: [default: sqlite]--lakehouse-option [postgres|postgres-immutable|sqlite|sqlite-immutable]
: [default: sqlite]--help
: Show this message and exit.
amsdal register-connection, reg-conn
¶
Registers and adds a new connection to the AMSDAL configuration.
Example of usage:
- Register a connection to a SQLite database:
amsdal reg-conn sqlite -creds db_path=path/to/file/db.sqlite3
-
Register a connection to a PostgreSQL database:
amsdal reg-conn postgres -creds dsn='postgresql://user:password@localhost:5432/mydatabase' -creds schema=public
-
Register a connection to a CSV file:
amsdal reg-conn csv -creds db_path=src/csv_dir/ -meta pk="data.csv:column_name"
Register existing connection flow:
- First of all, make sure the core migrations are applied and you have initialized lakehouse and default state
db using
amsdal migrations apply
- Run
amsdal reg-conn
command to register a new connection, e.g.amsdal reg-conn sqlite -creds db_path=external_db.sqlite3
- The connection was added to your config. Data from external connection was synced with lakehouse. The models were generated.
- Now you need to generate migrations for the new models. Run
amsdal migrations new
to generate migrations for the new models. - The last step is to apply the new migrations in fake mode. Run
amsdal migrations apply --fake
to apply the new migrations.
Usage:
$ amsdal register-connection, reg-conn [OPTIONS] DB_TYPE:{postgres|sqlite|csv}
Arguments:
DB_TYPE:{postgres|sqlite|csv}
: [required]
Options:
-creds TEXT
: Credentials for the connection in the format: prop="value". Theprop=1.0
format is also supported and will be converted to a float. To get a boolean, useprop=true
orprop=false
. To get a Path useprop="path/to/file"::path
. [required]-meta TEXT
: Metadata for the connection. Useful to specify primary keys, foreign keys, etc. The format is the next: pk="file_name.csv:column1,column2"--connection-name TEXT
: Name of the connection to be registered. If not provided, it will be generated.--backend TEXT
: Backend to use for the connection. If it's not provided, it will be resolved from db_type.--config PATH
: Path to custom config.yml file--help
: Show this message and exit.
amsdal generate, gen, g
¶
Generates application's files such as models, properties, transactions, etc.
Usage:
$ amsdal generate, gen, g [OPTIONS] COMMAND [ARGS]...
Options:
--help
: Show this message and exit.
Commands:
frontend_config, fconfig, fcfg, fc
: Generates Frontend Config fixture file for...hook, hk, h
: Generates hook file for specified model.model, mdl, md
: Generates model file.modifier, mod, mdf
: Generates modifier file for specified model.permission, p
: Generates permission fixture file for...property, prop, pr
: Generates property file for specified model.tests
: Generates tests for the given model.transaction, tr, t
: Generates transaction file with specified...
amsdal generate, gen, g frontend_config, fconfig, fcfg, fc
¶
Generates Frontend Config fixture file for the specified model.
Usage:
$ amsdal generate, gen, g frontend_config, fconfig, fcfg, fc [OPTIONS]
Options:
--model TEXT
: The model name. It should be provided in PascalCase. [required]--help
: Show this message and exit.
amsdal generate, gen, g hook, hk, h
¶
Generates hook file for specified model.
Usage:
$ amsdal generate, gen, g hook, hk, h [OPTIONS] HOOK_NAME:{pre_init|post_init|pre_create|post_create|pre_update|post_update|pre_delete|post_delete}
Arguments:
HOOK_NAME:{pre_init|post_init|pre_create|post_create|pre_update|post_update|pre_delete|post_delete}
: The hook name. [required]
Options:
--model TEXT
: The model name. It should be provided in PascalCase. [required]--help
: Show this message and exit.
amsdal generate, gen, g model, mdl, md
¶
Generates model file.
Example of usage:
amsdal generate model UserProfile -attrs "name:string email:string:index age:number:default=18"
So the format of attribute definition is: <name>:<type>[:<options>]
Supported types:
- string - Example:
position:string
- number - Example:
age:number
- boolean - Example:
is_active:boolean
- dict - Example:
metadata:dict:string:Country
(equivalent tometadata: dict
in Python) - belongs-to - Example:
user:belongs-to:User
(equivalent touser: User
in Python) - has-many - Example:
posts:has-many:Post
(equivalent toposts: list[Post]
in Python)
Where "belongs-to" and "has-many" are used to define the relationship between models. The "belongs-to" type is used to define the relationship where the model has a reference to another model. The "has-many" type is used to define the relationship where the model has a list of references to another model.
The options are:
- index - to mark the attribute as indexed. Example:
email:string:index
- unique - to mark the attribute as unique. Example:
email:string:unique
- required - to mark the attribute as required. Example:
email:string:required
- default - to set the default value for the attribute. It should be provided in the format:
default=<value>
. Example:age:number:default=18 name:string:default=Developer
In order to put multi-word default values, you should use quotes. Example:
amsdal generate model Person -attrs "name:string:default='John Doe'"
Note, dict
type does not support default value due to its complex structure.
The options can be combined. Examples:
- email:string:unique:required
- meta:dict:string:string:required:unique
- age:number:default=18:required
- name:string:default='John Doe':required
The ordering of the options does not matter.
Usage:
$ amsdal generate, gen, g model, mdl, md [OPTIONS] MODEL_NAME
Arguments:
MODEL_NAME
: The model name. It should be provided in PascalCase. [required]
Options:
-attrs, --attributes TEXT
: [default: None]-u, --unique TEXT
: [default: None]--help
: Show this message and exit.
amsdal generate, gen, g modifier, mod, mdf
¶
Generates modifier file for specified model.
Usage:
$ amsdal generate, gen, g modifier, mod, mdf [OPTIONS] MODIFIER_NAME:{constructor|display_name|version_name}
Arguments:
MODIFIER_NAME:{constructor|display_name|version_name}
: The modifier name. [required]
Options:
--model TEXT
: The model name. It should be provided in PascalCase. [required]--help
: Show this message and exit.
amsdal generate, gen, g permission, p
¶
Generates permission fixture file for specified model.
Usage:
$ amsdal generate, gen, g permission, p [OPTIONS]
Options:
--model TEXT
: The model name. It should be provided in PascalCase. [required]--create / --no-create
: Generate 'create' permission. [default: create]--read / --no-read
: Generate 'read' permission. [default: read]--update / --no-update
: Generate 'update' permission. [default: update]--delete / --no-delete
: Generate 'delete' permission. [default: delete]--help
: Show this message and exit.
amsdal generate, gen, g property, prop, pr
¶
Generates property file for specified model.
Usage:
$ amsdal generate, gen, g property, prop, pr [OPTIONS] PROPERTY_NAME
Arguments:
PROPERTY_NAME
: The property name. Note, it will always transform the provided name to camel_case. Enter the name in camel_case in order to avoid any issues. [required]
Options:
--model TEXT
: The model name. It should be provided in PascalCase. [required]--help
: Show this message and exit.
amsdal generate, gen, g tests
¶
Generates tests for the given model.
Examples of usage:
-
Generate unit tests for the model
User
:amsdal generate tests --model-name User
-
Generate unit tests for the model
User
with random test data:amsdal generate tests --model-name User --test-data-type=random
-
Generate unit tests for the model
User
with dummy test data:amsdal generate tests --model-name User --test-data-type=dummy
Usage:
$ amsdal generate, gen, g tests [OPTIONS]
Options:
--model-name TEXT
: The model name. It should be provided in PascalCase. [required]--test-type [unit]
: The type of test to generate. [default: unit]--test-data-type [random|dynamic|dummy]
: The type of test data to generate. [default: dynamic]-c, --config PATH
--seed INTEGER
: The seed for the random number generator. [default: 0]--help
: Show this message and exit.
amsdal generate, gen, g transaction, tr, t
¶
Generates transaction file with specified name.
Usage:
$ amsdal generate, gen, g transaction, tr, t [OPTIONS] TRANSACTION_NAME
Arguments:
TRANSACTION_NAME
: The transaction name. Note, it will always transform the provided name to camel_case. Enter the name in camel_case in order to avoid any issues. [required]
Options:
--help
: Show this message and exit.
amsdal cloud, cld
¶
Commands to interact with the Cloud Server.
Usage:
$ amsdal cloud, cld [OPTIONS] COMMAND [ARGS]...
Options:
--help
: Show this message and exit.
Commands:
expose-db, expose_db, edb
: Adds your IP to the allowlist of the...get-monitoring-info, get_monitoring_info, gmi
: Retrieves monitoring information for the...sync-db, sync_db, sdb
: Recreate local database from the remote one.dependencies, deps
: Manage dependencies for your Cloud Server...deployments, deploys, ds
: Manage app deployments on the Cloud Server.environments, envs, env
: Manage environments of your Cloud Server app.secrets, sec, s
: Manage secrets for your Cloud Server app.security
: Manage security of the Cloud Server app.
amsdal cloud, cld expose-db, expose_db, edb
¶
Adds your IP to the allowlist of the database and returns the connection configs.
Usage:
$ amsdal cloud, cld expose-db, expose_db, edb [OPTIONS]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.--ip-address TEXT
--help
: Show this message and exit.
amsdal cloud, cld get-monitoring-info, get_monitoring_info, gmi
¶
Retrieves monitoring information for the specified environment.
Usage:
$ amsdal cloud, cld get-monitoring-info, get_monitoring_info, gmi [OPTIONS]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.-o, --output [default|json|wide]
: [default: default]--help
: Show this message and exit.
amsdal cloud, cld sync-db, sync_db, sdb
¶
Recreate local database from the remote one.
Args: ctx (typer.Context): The Typer context object. env_name (typing.Annotated[typing.Optional, Option]): The name of the environment. Defaults to the current environment from configuration. db_type (DBType): The type of the database. Defaults to DBType.sqlite. skip_expose_db (bool): Whether to skip exposing the database. Defaults to False. skip_copy_data (bool): Whether to skip copying data. Defaults to False. skip_state_db (bool): Whether to skip syncing state db. Defaults to False. skip_lakehouse_db (bool): Whether to skip syncing lakehouse db. Defaults to False.
Returns: None
Usage:
$ amsdal cloud, cld sync-db, sync_db, sdb [OPTIONS]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.--db-type [postgres|sqlite|csv]
: [default: sqlite]-s
: Skip exposing the database-c
: Skip copying data-skip-state
: Skip sync state db-skip-lakehouse
: Skip sync lakehouse db--help
: Show this message and exit.
amsdal cloud, cld dependencies, deps
¶
Manage dependencies for your Cloud Server app. Without sub-command, it lists the dependencies.
Usage:
$ amsdal cloud, cld dependencies, deps [OPTIONS] COMMAND [ARGS]...
Options:
-o, --output [default|json|wide]
: [default: default]-a, --all
: List all dependencies.--sync
: Sync the dependencies from the Cloud Server to ".dependencies".--help
: Show this message and exit.
Commands:
delete, del, d
: Deletes dependency from your Cloud Server...new, n
: Creates a new dependency for your Cloud...
amsdal cloud, cld dependencies, deps delete, del, d
¶
Deletes dependency from your Cloud Server app.
Usage:
$ amsdal cloud, cld dependencies, deps delete, del, d [OPTIONS] DEPENDENCY_NAME
Arguments:
DEPENDENCY_NAME
: [required]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.--help
: Show this message and exit.
amsdal cloud, cld dependencies, deps new, n
¶
Creates a new dependency for your Cloud Server app.
Example usage:
amsdal cloud deps new libreoffice
Usage:
$ amsdal cloud, cld dependencies, deps new, n [OPTIONS] DEPENDENCY_NAME
Arguments:
DEPENDENCY_NAME
: [required]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.--help
: Show this message and exit.
amsdal cloud, cld deployments, deploys, ds
¶
Manage app deployments on the Cloud Server. Without sub-command, it lists the deployments.
Usage:
$ amsdal cloud, cld deployments, deploys, ds [OPTIONS] COMMAND [ARGS]...
Options:
-o, --output [default|json|wide]
: [default: default]-a, --all
-c, --current-only
: Show deployments only for current application--help
: Show this message and exit.
Commands:
delete, del, d
: Destroys the app on the Cloud Server.new, n
: Deploys the app to the Cloud Server.
amsdal cloud, cld deployments, deploys, ds delete, del, d
¶
Destroys the app on the Cloud Server.
Usage:
$ amsdal cloud, cld deployments, deploys, ds delete, del, d [OPTIONS] DEPLOYMENT_ID
Arguments:
DEPLOYMENT_ID
: [required]
Options:
--help
: Show this message and exit.
amsdal cloud, cld deployments, deploys, ds new, n
¶
Deploys the app to the Cloud Server.
Usage:
$ amsdal cloud, cld deployments, deploys, ds new, n [OPTIONS]
Options:
--deploy-type [lakehouse_only|include_state_db]
: [default: include_state_db]--lakehouse-type [spark|postgres|postgres-immutable]
: [default: postgres]--env TEXT
: Environment name. Default is the current environment from configuration.--from-env TEXT
: Environment name to copy from.--no-input
: Do not prompt for input.--skip-checks
: Skip checking secrets and dependencies before deploying.--help
: Show this message and exit.
amsdal cloud, cld environments, envs, env
¶
Manage environments of your Cloud Server app. Without any sub-command, it will list all environments.
Usage:
$ amsdal cloud, cld environments, envs, env [OPTIONS] COMMAND [ARGS]...
Options:
-o, --output [default|json|wide]
: [default: default]--help
: Show this message and exit.
Commands:
checkout, co
: Changes the current environment to...delete, del, d
: Deletes an environment from the Cloud...new, n
: Adds a new environment to your Cloud...
amsdal cloud, cld environments, envs, env checkout, co
¶
Changes the current environment to specified one.
Usage:
$ amsdal cloud, cld environments, envs, env checkout, co [OPTIONS] ENV_NAME
Arguments:
ENV_NAME
: [required]
Options:
--help
: Show this message and exit.
amsdal cloud, cld environments, envs, env delete, del, d
¶
Deletes an environment from the Cloud Server app.
Usage:
$ amsdal cloud, cld environments, envs, env delete, del, d [OPTIONS] ENV_NAME
Arguments:
ENV_NAME
: [required]
Options:
--help
: Show this message and exit.
amsdal cloud, cld environments, envs, env new, n
¶
Adds a new environment to your Cloud Server app.
Usage:
$ amsdal cloud, cld environments, envs, env new, n [OPTIONS] ENV_NAME
Arguments:
ENV_NAME
: [required]
Options:
--help
: Show this message and exit.
amsdal cloud, cld secrets, sec, s
¶
Manage secrets for your Cloud Server app. Without any sub-command, it will list all secrets.
Usage:
$ amsdal cloud, cld secrets, sec, s [OPTIONS] COMMAND [ARGS]...
Options:
-o, --output [default|json|wide]
: [default: default]--env TEXT
: Environment name. Default is the current environment from configuration.-v, --values
: Show secret values--sync
: Sync the dependencies from the Cloud Server to ".secrets".--help
: Show this message and exit.
Commands:
delete, del, d
: Deletes a secret from the Cloud Server app.new, n
: Adds a new secret to your Cloud Server app.
amsdal cloud, cld secrets, sec, s delete, del, d
¶
Deletes a secret from the Cloud Server app.
Usage:
$ amsdal cloud, cld secrets, sec, s delete, del, d [OPTIONS] SECRET_NAME
Arguments:
SECRET_NAME
: [required]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.--help
: Show this message and exit.
amsdal cloud, cld secrets, sec, s new, n
¶
Adds a new secret to your Cloud Server app.
Usage:
$ amsdal cloud, cld secrets, sec, s new, n [OPTIONS] SECRET_NAME SECRET_VALUE
Arguments:
SECRET_NAME
: [required]SECRET_VALUE
: [required]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.--help
: Show this message and exit.
amsdal cloud, cld security
¶
Manage security of the Cloud Server app.
Usage:
$ amsdal cloud, cld security [OPTIONS] COMMAND [ARGS]...
Options:
--help
: Show this message and exit.
Commands:
allowlist, alist, al
: Control who can access the APIbasic-auth, basic_auth, bauth, ba
: Hide the API behind a Basic Auth
amsdal cloud, cld security allowlist, alist, al
¶
Control who can access the API
Usage:
$ amsdal cloud, cld security allowlist, alist, al [OPTIONS] COMMAND [ARGS]...
Options:
--help
: Show this message and exit.
Commands:
delete, del, d
: Deletes your IP from the allowlist of the...new, n
: Adds your IP to the allowlist of the API.
amsdal cloud, cld security allowlist, alist, al delete, del, d
¶
Deletes your IP from the allowlist of the API.
Examples of usage:
amsdal cloud security allowlist delete
amsdal cloud security allowlist delete --ip-address 0.0.0.0
amsdal cloud security allowlist delete --ip-address 0.0.0.0/24
amsdal cloud security allowlist delete --ip-address 0.0.0.0,1.0.0.0/24
Usage:
$ amsdal cloud, cld security allowlist, alist, al delete, del, d [OPTIONS]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.--ip-address TEXT
: IP address, range or combination of both to delete from the allowlist. Will delete your IP if not provided.--help
: Show this message and exit.
amsdal cloud, cld security allowlist, alist, al new, n
¶
Adds your IP to the allowlist of the API.
Examples of usage:
amsdal cloud security allowlist new
amsdal cloud security allowlist new --ip-address 0.0.0.0
amsdal cloud security allowlist new --ip-address 0.0.0.0/24
amsdal cloud security allowlist new --ip-address 0.0.0.0,1.0.0.0/24
Usage:
$ amsdal cloud, cld security allowlist, alist, al new, n [OPTIONS]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.--ip-address TEXT
: IP address, range or combination of both to add to the allowlist. Will add your IP if not provided.--help
: Show this message and exit.
amsdal cloud, cld security basic-auth, basic_auth, bauth, ba
¶
Hide the API behind a Basic Auth
Usage:
$ amsdal cloud, cld security basic-auth, basic_auth, bauth, ba [OPTIONS] COMMAND [ARGS]...
Options:
--help
: Show this message and exit.
Commands:
delete, del, d
: Deletes the Basic Auth for the application...new, n
: Adds a Basic Auth to the application API.retrieve
: Retrieves the Basic Auth credentials for...
amsdal cloud, cld security basic-auth, basic_auth, bauth, ba delete, del, d
¶
Deletes the Basic Auth for the application API.
Usage:
$ amsdal cloud, cld security basic-auth, basic_auth, bauth, ba delete, del, d [OPTIONS]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.--help
: Show this message and exit.
amsdal cloud, cld security basic-auth, basic_auth, bauth, ba new, n
¶
Adds a Basic Auth to the application API.
Usage:
$ amsdal cloud, cld security basic-auth, basic_auth, bauth, ba new, n [OPTIONS]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.-u, --username TEXT
: Username for the Basic Auth. If not provided, a random username will be generated.-p, --password TEXT
: Password for the Basic Auth. If not provided, a random password will be generated.-o, --output [default|json|wide]
: [default: default]--help
: Show this message and exit.
amsdal cloud, cld security basic-auth, basic_auth, bauth, ba retrieve
¶
Retrieves the Basic Auth credentials for the application API.
Usage:
$ amsdal cloud, cld security basic-auth, basic_auth, bauth, ba retrieve [OPTIONS]
Options:
--env TEXT
: Environment name. Default is the current environment from configuration.-o, --output [default|json|wide]
: [default: default]--help
: Show this message and exit.
amsdal migrations, migs, mgs
¶
Commands to manage migrations. Without subcommand, it will show list of all migrations, which are applied and not applied including CORE and CONTRIB migrations.
Usage:
$ amsdal migrations, migs, mgs [OPTIONS] COMMAND [ARGS]...
Options:
-b, --build-dir PATH
: [default: .]-c, --config PATH
--help
: Show this message and exit.
Commands:
apply, apl, ap
: Applies migrations to the application.new, n
: Creates schema migration based on the...
amsdal migrations, migs, mgs apply, apl, ap
¶
Applies migrations to the application.
This command applies migrations in the following order:
- Core migrations
- Contrib migrations
- App migrations
Example of usage:
-
Applies all pending migrations:
amsdal migrations apply
-
Applies all migrations up to a module type, e.g. CONTRIB:
It will apply all core migrations + all contrib migrationsamsdal migrations apply --module contrib
-
Applies migrations up to a specific number:
If you didn't specify the module type, it will apply migrations up to the specified number for the app module.amsdal migrations apply --number 0002
-
Applies migrations in fake mode:
It will apply all pending migrations in fake mode, so the actual changes will not be applied to the database.amsdal migrations apply --fake
Usage:
$ amsdal migrations, migs, mgs apply, apl, ap [OPTIONS]
Options:
-n, --number TEXT
: Number of migration, e.g. 0002 or just 2. Use "zero" as a number to unapply all migrations including initial one.-b, --build-dir PATH
: [default: .]-m, --module [type|core|user|contrib]
: [default: user]-f, --fake
-c, --config PATH
--help
: Show this message and exit.
amsdal migrations, migs, mgs new, n
¶
Creates schema migration based on the changes in the models' schemas or creates an empty data migration using --data flag.
Example usage:
-
Automatically creates a schema migrations based on the changes in the models' schemas:
amsdal migrations new
-
Creates a schema migration with a custom name:
amsdal migrations new --name my_custom_migration
-
Creates a data migration:
The data migrations allow you to write a python script to migrate your data. Useful for example when you have added a new column to the table and you want to populate it with some data. So you first generate a schema migration that adds the column and then you create a data migration that populates the column with the data.amsdal migrations new --data --name my_data_migration
Usage:
$ amsdal migrations, migs, mgs new, n [OPTIONS]
Options:
-b, --build-dir PATH
: [default: .]-n, --name TEXT
: Migration name-d, --data
: Create data migration-c, --config PATH
--help
: Show this message and exit.
amsdal worker, w
¶
Commands to run worker.
Usage:
$ amsdal worker, w [OPTIONS] COMMAND [ARGS]...
Options:
--help
: Show this message and exit.
Commands:
run
: Runs a worker for periodic tasks.
amsdal worker, w run
¶
Runs a worker for periodic tasks.
Usage:
$ amsdal worker, w run [OPTIONS]
Options:
--mode [executor|scheduler|hybrid]
: Worker mode. [default: executor]--help
: Show this message and exit.