Skip to content

Batch put and delete semantics inconsistent #224

Description

@jnwatson

Happybase version 1.2.0.

A batch.delete, then a batch.put on the same key in the same batch results in the key not being present. Outside of a batch, this has the expected semantics.

Does anybody have any idea why?

Example:

import happybase

connection = happybase.Connection('hbase-docker', 9090)
try:
    connection.create_table('t2', {'s': dict()})
except Exception:
    pass
table = connection.table('t2')
key = b'key1'
val = b'abcd'

# A put/delete outside of a batch
table.delete(key)
table.put(key, {b's:d': val})
actual = table.row(key)
if actual[b's:d'] != val:
    print('Invalid value outside of batch')

# Same inside of a batch
b = table.batch()
b.delete(key)
b.put(key, {b's:d': val})
b.send()

actual = table.row(key)
if b's:d' not in actual:
    print('Value missing')
elif actual.get(b's:d') != val:
    print('Invalid value for batch')

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions