Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[BigTable] Insert new record with the existing row_key multiple times? #2677

Copy link
Copy link
@dmitry-saritasa

Description

@dmitry-saritasa
Issue body actions

Is it possible to append additional rows with the existing 'rowkey' in Bigtable?

it seems when I call

from operator import itemgetter
import random

def get_row_key(record, template):
    attrs = itemgetter(*template)
    vals = attrs(record)
    return '#'.join((str(v) for v in vals)

# main
record = dict(
    user=random.randint(10, 1000),
    viewability=30,
    developer=1,
    advertiser=2,
    campaign=3,
    game=4,
    spot=5,
    asset=6,
    sex='m',
    age=50,
    browser='chrome',
    browser_ver='55',
    os='android',
    os_ver='5.0',
    mobile=True,
    desktop=False,
    country='us',
    ip_addr='127.0.0.1',
    created=1478218018,
    tick_size=5,
    session='aaaa'
    is_generic=False
)

# pattern used in itemgetter
rowkey = ('asset', 'created', 'advertiser')
row = table.row(get_row_key(record, pattern))
for column, val in record.items():
    row.set_cell('stat', column, val)
row.commit()

so if I run code against the same record 3 times (which will produce the same rowkey for the row) I only get a single row. It seems 1st row is inserted, and then 2nd and 3rd mutate the same row. How to make it append? (OR row_key HAS TO BE UNIQUE?)

thanks,
Dmitry

Metadata

Metadata

Assignees

Labels

api: bigtableIssues related to the Bigtable API.Issues related to the Bigtable API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.