コード例 #1
0
ファイル: master_actions.py プロジェクト: ALMPartners/ahjo
def data(context):
    """Insert data."""
    op.deploy_sqlfiles(context.get_engine(), './database/data/', "Inserting data")
    op.update_git_version(
        context.get_engine(),
        context.configuration.get('git_table_schema', 'dbo'),
        context.configuration.get('git_table', 'git_version'),
        repository = context.configuration.get('url_of_remote_git_repository'),
        git_version_info_path = context.configuration.get('git_version_info_path')
    )
コード例 #2
0
ファイル: master_actions.py プロジェクト: ALMPartners/ahjo
def structure(context):
    """(MSSQL) Create database structure (schemas, tables, constraints). Not available if these are created with alembic."""
    success1 = op.deploy_sqlfiles(context.get_engine(), './database/schema/', 'Creating schemas')
    success2 = op.deploy_sqlfiles(context.get_engine(), './database/tables/', 'Creating tables')
    success3 = op.deploy_sqlfiles(context.get_engine(), './database/constraints/', 'Creating constraints')
    if success1 is False and success2 is False and success3 is False:
        logger.error(
            'Failed to create database structure using primary method, attempting alternate method.')
        try:
            op.create_db_structure(context.get_conn_info())
        except:
            logger.error('Failed to create database structure using alternate method. File database/create_db_structure.sql does not exist.'
                         '\nRefer to the Ahjo documentation for creating database structure.\n------')
コード例 #3
0
ファイル: master_actions.py プロジェクト: ALMPartners/ahjo
def deploy_files(context, **kwargs):
    """(MSSQL) Run 'alembic upgrade head' Deploy files. Update Git version."""
    deploy_files = kwargs["files"] if "files" in kwargs else None
    if isinstance(deploy_files, list) and len(deploy_files) > 0:
        op.upgrade_db_to_latest_alembic_version(context.config_filename)
        op.deploy_sqlfiles(context.get_engine(), deploy_files, "Deploying sql files")
        op.update_git_version(
            context.get_engine(),
            context.configuration.get('git_table_schema', 'dbo'),
            context.configuration.get('git_table', 'git_version'),
            repository = context.configuration.get('url_of_remote_git_repository'),
            git_version_info_path = context.configuration.get('git_version_info_path')
        )
    else :
        logger.warning('Check argument: "files".')
        return
コード例 #4
0
ファイル: master_actions.py プロジェクト: ALMPartners/ahjo
def deploy(context):
    """(MSSQL) Run 'alembic upgrade head'. Deploy functions, views and prodecures. Update extended properties and Git version."""
    op.upgrade_db_to_latest_alembic_version(context.config_filename)
    op.deploy_sqlfiles(context.get_engine(), "./database/functions/", "Deploying functions")
    op.deploy_sqlfiles(context.get_engine(), "./database/views/", "Deploying views")
    op.deploy_sqlfiles(context.get_engine(), "./database/procedures/", "Deploying procedures")
    op.update_git_version(
        context.get_engine(),
        context.configuration.get('git_table_schema', 'dbo'),
        context.configuration.get('git_table', 'git_version'),
        repository = context.configuration.get('url_of_remote_git_repository'),
        git_version_info_path = context.configuration.get('git_version_info_path')
    )
    op.update_db_object_properties(
        context.get_engine(),
        context.configuration.get('metadata_allowed_schemas')
    )
コード例 #5
0
ファイル: master_actions.py プロジェクト: ALMPartners/ahjo
def test(context):
    """Run tests."""
    op.deploy_sqlfiles(context.get_engine(), './database/tests/', "Running tests", display_output=True)
コード例 #6
0
ファイル: master_actions.py プロジェクト: ALMPartners/ahjo
def testdata(context):
    """Insert testdata."""
    op.deploy_sqlfiles(context.get_engine(), './database/data/testdata/', "Inserting test data")
コード例 #7
0
ファイル: master_actions.py プロジェクト: ALMPartners/ahjo
def assembly(context):
    """(MSSQL) Drop and deploy CLR-procedures and assemblies."""
    op.drop_sqlfile_objects(context.get_engine(), 'PROCEDURE', "./database/clr-procedures/", "Dropping CLR-procedures")
    op.drop_sqlfile_objects(context.get_engine(), 'ASSEMBLY', "./database/assemblies/", "Dropping assemblies")
    op.deploy_sqlfiles(context.get_engine(), "./database/assemblies/", "Deploying assemblies")
    op.deploy_sqlfiles(context.get_engine(), "./database/clr-procedures/", "Deploying CLR-procedures")