コード例 #1
0
def create_table(
    ctx,
    dataset_id,
    table_id,
    path,
    job_config_params,
    if_table_exists,
    force_dataset,
    if_storage_data_exists,
    if_table_config_exists,
    columns_config_url,
):

    Table(table_id=table_id, dataset_id=dataset_id, **ctx.obj).create(
        path=path,
        job_config_params=job_config_params,
        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,
        columns_config_url=columns_config_url,
    )

    click.echo(
        click.style(
            f"Table `{dataset_id}_staging.{table_id}` was created in BigQuery",
            fg="green",
        ))
コード例 #2
0
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",
        ))
コード例 #3
0
def update_columns(ctx, dataset_id, table_id, columns_config_url):

    Table(table_id=table_id, dataset_id=dataset_id,
          **ctx.obj).update_columns(columns_config_url=columns_config_url, )

    click.echo(
        click.style(
            f"All columns descriptions `{dataset_id}*.{table_id}` were updated in table_config.yaml",
            fg="green",
        ))
コード例 #4
0
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",
        ))
コード例 #5
0
def upload_table(ctx, dataset_id, table_id, filepath, partitions, if_exists):

    blob_name = Table(table_id=table_id, dataset_id=dataset_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",
        ))
コード例 #6
0
ファイル: cli.py プロジェクト: avila/mais
def init_table(
    ctx,
    dataset_id,
    table_id,
    data_sample_path,
    if_folder_exists,
    if_table_config_exists,
):

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

    click.echo(
        click.style(
            f"Table `{table_id}` folder and metadata were created at {t.metadata_path}{dataset_id}",
            fg="green",
        ))
コード例 #7
0
def delete_table(ctx, dataset_id, table_id, mode):

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