How to use the databand.config function in databand

To help you get started, we’ve selected a few databand examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github databand-ai / dbnd / modules / dbnd-airflow / src / dbnd_airflow / cli / cmd_airflow_db.py View on Github external
from dbnd._core.cli.utils import with_fast_dbnd_context
from dbnd._core.context.dbnd_project_env import _SHELL_COMPLETION
from dbnd._core.utils.cli import NotRequiredIf
from dbnd._vendor import click


if not _SHELL_COMPLETION:
    from airflow.bin import cli as af_cli

    from dbnd._core.errors import DatabandSystemError
    from dbnd._core.utils.project.project_fs import project_path
    from dbnd_airflow.airflow_override import patch_models, unpatch_models
    from dbnd_airflow.web.airflow_app import cached_appbuilder


dbnd_config.load_system_configs(force=True)
logger = logging.getLogger(__name__)


@click.command()
@click.option("--no-default-user", is_flag=True, help="Do not create default user")
def airflow_db_init(no_default_user):
    """Initialize Airflow database"""
    _db_init(no_default_user)


# extracted so it can be called by pytest
@with_fast_dbnd_context
def _db_init(no_default_user, no_airflow_user=False):
    from airflow import settings

    unpatch_models()