Exemplo n.º 1
0
def team():
    """Sample team entities."""
    db = db_bind(DB_CONNECT)

    click.echo('writing team')
    with db_session:
        _entries = []
        for _entry in _data.get("team"):
            click.echo(f'getting org {_entry["organization"]["bat"]}')
            _entry["organization"] = db.Organization.get(
                bat=f'{_entry["organization"]["bat"]}')
            _entries.append(_entry)

        load_entity("team", db.Team, _entries)
Exemplo n.º 2
0
def domain():
    """Sample domain entities."""
    db = db_bind(DB_CONNECT)

    click.echo('writing domain')
    with db_session:
        _entries = []
        for _entry in _data.get("domain"):
            click.echo(f'getting org {_entry["organization"]["bat"]}')
            _entry["organization"] = db.Organization.get(
                bat=f'{_entry["organization"]["bat"]}')
            _entries.append(_entry)

        load_entity("domain", db.Domain, _entries)
Exemplo n.º 3
0
def allocation():
    """Sample category allocation."""
    db = db_bind(DB_CONNECT)

    click.echo('team category allocation')
    with db_session:
        _entries = []
        for _entry in _data.get("category_allocation"):
            click.echo(f'getting team {_entry["team"]["bat"]}')
            _entry["team"] = db.Team.get(bat=f'{_entry["team"]["bat"]}')

            click.echo(f'getting category {_entry["category"]["bat"]}')
            _entry["category"] = db.Category.get(
                bat=f'{_entry["category"]["bat"]}')

            if db.Category_Allocation.get(**_entry):
                click.echo(f'skipping {_entry["category"].name}')
            else:
                click.echo(f'writing {_entry["category"].name}')
                db.Category_Allocation(**_entry)
Exemplo n.º 4
0
def category():
    """Sample category entities."""
    db = db_bind(DB_CONNECT)

    click.echo('loading category')
    load_entity("category", db.Category, _data.get("category"))
Exemplo n.º 5
0
def org():
    """Sample organization."""
    db = db_bind(DB_CONNECT)

    click.echo('loading organization')
    load_entity("organization", db.Organization, _data.get("organization"))
Exemplo n.º 6
0
def create():
    """Create database tables."""
    db_bind(DB_CONNECT, create_tables=True)
Exemplo n.º 7
0
def person():
    """Sample person entities."""
    db = db_bind(DB_CONNECT)

    click.echo('writing person')
    load_entity("person", db.Person, _data.get("person"))
Exemplo n.º 8
0
def technology():
    """Sample technology entities."""
    db = db_bind(DB_CONNECT)

    click.echo('writing technology')
    load_entity("technology", db.Technology, _data.get("technology"))