Bloop: DynamoDB Modeling

DynamoDB's concurrency model is great, but using it correctly is tedious and unforgiving. Bloop manages that complexity for you.

Features

  • Simple declarative modeling
  • Extensible type system, useful built-in types
  • DynamoDBStreams interface that makes sense
  • Secure expression-based wire format
  • Simple atomic operations
  • Expressive conditions
  • Diff-based saves

Ergonomics

class Account(BaseModel):
    id = Column(UUID, hash_key=True)
    name = Column(String)
    email = Column(String)
    by_email = GlobalSecondaryIndex(
        projection='keys', hash_key='email')

engine.bind(Account)

some_account = Account(
    id=uuid.uuid4(),
    email='foo@bar.com')
engine.save(some_account)

q = engine.query(
    Account.by_email,
    key=Account.email == 'foo@bar.com')

same_account = q.one()
print(same_account.id)

Never worry about iterator types, or tracking shard lineage again:

template = '''
Old: {old}
New: {new}

Event Details:
{meta}

'''

stream = engine.stream(User, 'trim_horizon')
while True:
    record = next(stream)
    if record:
        print(template.format(**record)
    else:
        time.sleep(0.5)

What's Next

Get started by installing Bloop, or check out a larger example.