Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

halayli/cal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Cassandra Abstraction Library.

CAL abstracts Cassandra's confusing terminologies and allows you to use
Python like syntax to access/manipulate Cassandra records.

The library is not complete and doesn't support batch inserts/deletions yet.

Usage:
Assuming Users is a columnFamily of type Super in a Cassandara node.

from cal import dbConnect
keyspace = dbConnect()['MyDatabase']
users = keyspace['Users']

To insert a column/superColumn:
  users['joe']['personalInfo'].insert('emailAddress', '[email protected]')

To fetch column/columns:
  users['joe'].get()
or more granular
  users['joe']['personalInfo'].get()
which is almost equivalent to:
  users['joe'].get(['personalInfo'])

To delete a column:
  del users['joe']
or
  del users['joe']['personalInfo']
or
  del users['joe']['personalInfo']['emailAddress']

To count the number of columns:
  users['joe'].count()
  or
  users['joe']['personalInfo'].count()

If Users is a columnFamily of type Standard, then you only nest one level deep:
users['joe'].insert('emailAddress', '[email protected]')

About

Cassandra Abstraction Library for Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages