Exemplo n.º 1
0
def create_table(
    ctx,
    dataset_id,
    table_id,
    path,
    job_config_params,
    partitioned,
    if_table_exists,
    force_dataset,
    if_storage_data_exists,
    if_table_config_exists,
):

    Table(table_id=table_id, dataset_id=dataset_id, **ctx.obj).create(
        path=path,
        job_config_params=job_config_params,
        partitioned=partitioned,
        if_table_exists=if_table_exists,
        force_dataset=force_dataset,
        if_storage_data_exists=if_storage_data_exists,
        if_table_config_exists=if_table_config_exists,
    )

    click.echo(
        click.style(
            f"Table `{dataset_id}_staging.{table_id}` was created in BigQuery",
            fg="green",
        ))
Exemplo n.º 2
0
def upload_table(ctx, dataset_id, table_id, filepath, partitions, if_exists):

    blob_name = Table(dataset_id, table_id, **ctx.obj).append(
        filepath=filepath, partitions=partitions, if_exists=if_exists
    )

    click.echo(click.style(f"Data was added to `{dataset_id}.{table_id}`", fg="green",))
Exemplo n.º 3
0
Arquivo: cli.py Projeto: rxjunior/mais
def publish_table(ctx, dataset_id, table_id, if_exists):

    Table(table_id=table_id, dataset_id=dataset_id,
          **ctx.obj).publish(if_exists=if_exists, )

    click.echo(
        click.style(
            f"Table `{dataset_id}.{table_id}` was published in BigQuery",
            fg="green",
        ))
Exemplo n.º 4
0
Arquivo: cli.py Projeto: rxjunior/mais
def update_table(ctx, dataset_id, table_id, mode):

    Table(table_id=table_id, dataset_id=dataset_id,
          **ctx.obj).update(mode=mode, )

    click.echo(
        click.style(
            f"All tables `{dataset_id}*.{table_id}` were updated in BigQuery",
            fg="green",
        ))
Exemplo n.º 5
0
Arquivo: cli.py Projeto: rxjunior/mais
def init_table(ctx, dataset_id, table_id, data_sample_path, if_exists):

    t = Table(table_id=table_id, dataset_id=dataset_id,
              **ctx.obj).init(data_sample_path=data_sample_path,
                              if_exists=if_exists)

    click.echo(
        click.style(
            f"Table `{table_id}` folder and metadata were created at {t.metadata_path}{dataset_id}",
            fg="green",
        ))
Exemplo n.º 6
0
Arquivo: cli.py Projeto: rxjunior/mais
def delete_table(ctx, dataset_id, table_id, mode):

    Table(table_id=table_id, dataset_id=dataset_id,
          **ctx.obj).delete(mode=mode, )