def populate(connection, reset, force, skip):
    """Populate all."""
    for idx, name, manager in _iterate_managers(connection, skip):
        click.echo(
            click.style(f'[{idx}/{len(MANAGERS)}] ', fg='blue', bold=True) +
            click.style(f'populating {name}', fg='cyan', bold=True)
        )

        if reset:
            click.echo('deleting the previous instance of the database')
            manager.drop_all()
            click.echo('creating new models')
            manager.create_all()

        elif manager.is_populated() and not force:
            click.echo(f'👍 {name} is already populated. use --force to overwrite', color='red')
            continue

        try:
            manager.populate()
        except Exception:
            logger.exception('%s population failed', name)
            click.secho(f'👎 {name} population failed', fg='red', bold=True)
def populate(connection, reset, force, skip):
    """Populate all."""
    for idx, name, manager in _iterate_managers(connection, skip):
        click.echo(
            click.style(f'[{idx}/{len(MANAGERS)}] ', fg='blue', bold=True) +
            click.style(f'populating {name}', fg='cyan', bold=True)
        )

        if reset:
            click.echo('deleting the previous instance of the database')
            manager.drop_all()
            click.echo('creating new models')
            manager.create_all()

        elif manager.is_populated() and not force:
            click.echo(f'👍 {name} is already populated. use --force to overwrite', color='red')
            continue

        try:
            manager.populate()
        except Exception:
            logger.exception('%s population failed', name)
            click.secho(f'👎 {name} population failed', fg='red', bold=True)
def populate ( connection , reset , force , skip ) : for idx , name , manager in _iterate_managers ( connection , skip ) : click . echo ( click . style ( f'[{idx}/{len(MANAGERS)}] ' , fg = 'blue' , bold = True ) + click . style ( f'populating {name}' , fg = 'cyan' , bold = True ) ) if reset : click . echo ( 'deleting the previous instance of the database' ) manager . drop_all ( ) click . echo ( 'creating new models' ) manager . create_all ( ) elif manager . is_populated ( ) and not force : click . echo ( f'👍 {name} is already populated. use --force to overwrite', c o or='r e d') continue try : manager . populate ( ) except Exception : logger . exception ( '%s population failed' , name ) click . secho ( f'👎 {name} population failed', f g 'r e d', b o d=Tr u e)
Populate all.
Populate all .