dvc.app.cli.commands.database package#
Submodules#
dvc.app.cli.commands.database.backend module#
- class dvc.app.cli.commands.database.backend.DatabaseInteractor(config_file_path_str: Optional[str])[source]#
Bases:
object
Exposes API to interact with Various Database flavours
- MAPPING = {SupportedDatabaseFlavour.Postgres: <function DatabaseInteractor.<lambda>>}#
- property config_file_reader: dvc.core.config.ConfigReader#
- Returns
ConfigReader
- property conn#
- Returns
- property database_revision_files_manager: dvc.core.config.DatabaseRevisionFilesManager#
- Returns
DatabaseRevisionFilesManager
- execute_single_sql_file(database_revision_file: dvc.core.struct.DatabaseRevisionFile, mark_only: bool = False) None [source]#
Execute DatabaseRevisionFile to the Database and optionally mark it as metadata
- Parameters
database_revision_file – Database Revision File to apply to the Database
mark_only – whether or not to mark the SQL file as being done as metadata, without actually executing the SQL file
- Returns
- get_target_database_revision_files(steps: int, pointer: Optional[dvc.core.config.DatabaseRevisionFilesManager.Pointer] = None) List[dvc.core.struct.DatabaseRevisionFile] [source]#
Helper to get target database revision files Check number of returned revision files must be same as steps specified
- Parameters
steps – Specify how many steps ahead/ backwards.. When None, it goes to the very end in either direction
- Returns
List of DatabaseRevisionFiles, if any
- property latest_database_version: dvc.core.struct.DatabaseVersion#
- Returns
latest Database Version
- property sql_file_executor#
Module contents#
database subcommand
- dvc.app.cli.commands.database.current(config_file_path: Optional[str] = <typer.models.OptionInfo object>) None [source]#
Check the current Database Version
- Parameters
config_file_path – String pointing to the path where configuration file is located
- Returns
- dvc.app.cli.commands.database.downgrade(config_file_path: Optional[str] = <typer.models.OptionInfo object>, mark_only: bool = <typer.models.OptionInfo object>, confirm: bool = <typer.models.OptionInfo object>, steps: int = <typer.models.OptionInfo object>, base: bool = <typer.models.OptionInfo object>) None [source]#
Downgrade the Current Database Version by applying a corresponding Downgrade Revision Version
- Parameters
config_file_path – String pointing to the path where configuration file is located
mark_only – mark the SQL file as being done as metadata, without actually executing the SQL file
confirm – whether or not to prompt user for confirmation
steps – Number of steps requested to downgrade the database version
- Returns
- dvc.app.cli.commands.database.init(config_file_path: Optional[str] = <typer.models.OptionInfo object>) None [source]#
Generate configuration template & Initialise database
- Parameters
config_file_path – String pointing to the path where configuration file is located
- Returns
- dvc.app.cli.commands.database.ping(config_file_path: Optional[str] = <typer.models.OptionInfo object>) None [source]#
Ping the current database connection
- Parameters
config_file_path – String pointing to the path where configuration file is located
- Returns
- dvc.app.cli.commands.database.upgrade(config_file_path: Optional[str] = <typer.models.OptionInfo object>, mark_only: bool = <typer.models.OptionInfo object>, confirm: bool = <typer.models.OptionInfo object>, steps: int = <typer.models.OptionInfo object>, head: bool = <typer.models.OptionInfo object>) None [source]#
Upgrade the Current Database Version by applying a corresponding Upgrade Revision Version
- Parameters
config_file_path – String pointing to the path where configuration file is located
mark_only – whether or not to mark the SQL file as being done as metadata, without actually executing the SQL file
confirm – whether or not to prompt user for confirmation
steps – Number of steps requested to downgrade the database version
- Returns
None