SequoiaDB
 All Classes Functions
Public Member Functions | List of all members
pysequoiadb.collectionspace.collectionspace Class Reference
Inheritance diagram for pysequoiadb.collectionspace.collectionspace:

Public Member Functions

def __init__
 
def __del__
 
def __repr__
 
def __getattr__
 
def __getitem__
 
def get_collection
 
def create_collection
 
def drop_collection
 
def rename_collection
 
def get_collection_space_name
 
def alter
 
def set_domain
 
def remove_domain
 
def enable_capped
 
def disable_capped
 
def set_attributes
 

Detailed Description

CollectionSpace for SequoiaDB

All operation need deal with the error code returned first, if it has.
Every error code is not SDB_OK(or 0), it means something error has appeared,
and user should deal with it according the meaning of error code printed.

@version: execute to get version
          >>> import pysequoiadb
          >>> print pysequoiadb.get_version()

@notice : The dict of built-in Python is hashed and non-ordered. so the
          element in dict may not the order we make it. we make a dict and
          print it like this:
          ...
          >>> a = {"avg_age":24, "major":"computer science"}
          >>> a
          >>> {'major': 'computer science', 'avg_age': 24}
          ...
          the elements order it is not we make it!!
          therefore, we use bson.SON to make the order-sensitive dict if the
          order is important such as operations in "$sort", "$group",
          "split_by_condition", "aggregate","create_collection"...
          In every scene which the order is important, please make it using
          bson.SON and list. It is a subclass of built-in dict
          and order-sensitive

Constructor & Destructor Documentation

def pysequoiadb.collectionspace.collectionspace.__init__ (   self)
invoked when a new object is producted.

Exceptions:
   pysequoiadb.error.SDBBaseError
def pysequoiadb.collectionspace.collectionspace.__del__ (   self)
delete a object existed.

Exceptions:
   pysequoiadb.error.SDBBaseError

Member Function Documentation

def pysequoiadb.collectionspace.collectionspace.__getattr__ (   self,
  name 
)
support client.cs to access to collection.

   eg.
   cc = client()
   cs = cc.test
   cl = cs.test_cl  # access to collection named 'test_cl'

   and we should pass '__members__' and '__methods__',
   becasue dir(cc) will invoke __getattr__("__members__") and
   __getattr__("__methods__").

   if success, a collection object will be returned.

Exceptions:
   pysequoiadb.error.SDBBaseError
def pysequoiadb.collectionspace.collectionspace.__getitem__ (   self,
  name 
)
support [] to access to collection.

   eg.
   cc = client()
   cs = cc['test']
   cl = cs['test_cl']   # access to collection named 'test_cl'.

Exceptions:
   pysequoiadb.error.SDBBaseError
def pysequoiadb.collectionspace.collectionspace.alter (   self,
  options 
)
Alter the current collection space.

Parameters:
   Name     Type           Info:
   options   dict          The options for alter collection space, including
                   Domain      : domain of collection space
                   PageSize    : page size of collection space
                   LobPageSize : LOB page size of collection space
def pysequoiadb.collectionspace.collectionspace.create_collection (   self,
  cl_name,
  options = None 
)
create a collection using name and options.

Parameters:
   Name      Type     Info:
   cl_name   str      The collection name.
   options   dict     The options for creating collection or None for not specified any options.
                      Please visit this url: "http://doc.sequoiadb.com/cn/index-cat_id-1432190821-edition_id-304"
                      to get more details.
Return values:
   a collection object created
Exceptions:
   pysequoiadb.error.SDBBaseError
def pysequoiadb.collectionspace.collectionspace.disable_capped (   self)
Alter the current collection space to disble capped.
def pysequoiadb.collectionspace.collectionspace.drop_collection (   self,
  cl_name 
)
Drop the specified collection in current collection space.

Parameters:
   Name      Type     Info:
   cl_name   str      The collection name.
Exceptions:
   pysequoiadb.error.SDBTypeError
   pysequoiadb.error.SDBBaseError
def pysequoiadb.collectionspace.collectionspace.enable_capped (   self)
Alter the current collection space to enable capped.
def pysequoiadb.collectionspace.collectionspace.get_collection (   self,
  cl_name 
)
Get the named collection.

Parameters:
   Name         Type     Info:
   cl_name      str      The short name of the collection.
Return values:
   a collection object of query
Exceptions:
   pysequoiadb.error.SDBBaseError
def pysequoiadb.collectionspace.collectionspace.get_collection_space_name (   self)
Get the current collection space name.

Return values:
   The name of current collection space.
Exceptions:
   pysequoiadb.error.SDBBaseError
def pysequoiadb.collectionspace.collectionspace.remove_domain (   self)
Alter the current collection space to remove domain.
def pysequoiadb.collectionspace.collectionspace.rename_collection (   self,
  old_name,
  new_name,
  options = None 
)
Rename the specified collection in current collection space.

Parameters:
   Name      Type     Info:
   old_name  str      The original name of collection.
   new_name  str      The new name of collection.
   options   dict     Options for renaming.
Exceptions:
   pysequoiadb.error.SDBTypeError
   pysequoiadb.error.SDBBaseError
def pysequoiadb.collectionspace.collectionspace.set_attributes (   self,
  options 
)
Alter the current collection space.

Parameters:
   Name     Type           Info:
   options   dict          The options for alter collection space, including
                   Domain      : domain of collection space
                   PageSize    : page size of collection space
                   LobPageSize : LOB page size of collection space
def pysequoiadb.collectionspace.collectionspace.set_domain (   self,
  options 
)
Alter the current collection space to set domain.

Parameters:
   Name     Type           Info:
   options   dict          The options for alter collection space, including
                 Domain      : domain of collection space

The documentation for this class was generated from the following file: