def read_filter(project_id, instance_id, table_id):
    client = bigtable.Client(project=project_id, admin=True)
    instance = client.instance(instance_id)
    table = instance.table(table_id)

    rows = table.read_rows(filter_=row_filters.ValueRegexFilter(b"PQ2A.*$"))
    for row in rows:
        print_row(row)
Beispiel #2
0
def filter_limit_value_regex(project_id, instance_id, table_id):
    client = bigtable.Client(project=project_id, admin=True)
    instance = client.instance(instance_id)
    table = instance.table(table_id)

    rows = table.read_rows(
        filter_=row_filters.ValueRegexFilter("PQ2A.*$".encode("utf-8")))
    for row in rows:
        print_row(row)
Beispiel #3
0
def filter_composing_interleave(project_id, instance_id, table_id):
    client = bigtable.Client(project=project_id, admin=True)
    instance = client.instance(instance_id)
    table = instance.table(table_id)

    rows = table.read_rows(filter_=row_filters.RowFilterUnion(
        filters=[row_filters.ValueRegexFilter("true"),
                 row_filters.ColumnQualifierRegexFilter("os_build")]))
    for row in rows:
        print_row(row)
Beispiel #4
0
def filter_composing_condition(project_id, instance_id, table_id):
    client = bigtable.Client(project=project_id, admin=True)
    instance = client.instance(instance_id)
    table = instance.table(table_id)

    rows = table.read_rows(filter_=row_filters.ConditionalRowFilter(
        base_filter=row_filters.RowFilterChain(filters=[
            row_filters.ColumnQualifierRegexFilter("data_plan_10gb"),
            row_filters.ValueRegexFilter("true")
        ]),
        true_filter=row_filters.ApplyLabelFilter(label="passed-filter"),
        false_filter=row_filters.ApplyLabelFilter(label="filtered-out")))
    for row in rows:
        print_row(row)
def write_conditional(project_id, instance_id, table_id):
    client = bigtable.Client(project=project_id, admin=True)
    instance = client.instance(instance_id)
    table = instance.table(table_id)

    timestamp = datetime.datetime.utcnow()
    column_family_id = "stats_summary"

    row_key = "phone#4c410523#20190501"

    row_filter = row_filters.RowFilterChain(filters=[
        row_filters.FamilyNameRegexFilter(column_family_id),
        row_filters.ColumnQualifierRegexFilter("os_build"),
        row_filters.ValueRegexFilter("PQ2A\\..*"),
    ])
    row = table.conditional_row(row_key, filter_=row_filter)
    row.set_cell(column_family_id, "os_name", "android", timestamp)
    row.commit()

    print("Successfully updated row's os_name.")