Module Expr Str ClassDef bases NameLoad body Expr Str Assign NameStore Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults vararg kwarg body Expr Str TryExcept body Assign NameStore Call NameLoad NameLoad NameLoad handlers ExceptHandler body Expr Call AttributeLoad NameLoad attr Raise orelse Expr Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults vararg body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults vararg body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Raise NameLoad decorator_list decorator_list
N/A N/A 
kalapy.db.engines.interface
~~~~~~~~~~~~~~~~~~~~~~~~~~~

This module defines the database interface to be implemented by backend engines.
The implementation is meant for internal use only. Users should use Model API
instead.

:copyright: (c) 2010 Amit Mendapara.
:license: BSD, see LICENSE for more details.
 IDatabase N/A object N/A N/A The database interface. Backend engines should implement this class
    with name `Database`.

    :param name: the name of the database
    :param host: the hostname where the database server is running
    :param port: the port on which the database server is listening
    :param user: the user name to connect to the database
    :param password: the database password
     N/A schema_mime text/plain __init__ N/A N/A self name host port user password N/A None None None None N/A N/A Initialize the database.
         N/A N/A self name name N/A N/A self host host N/A N/A self port port N/A N/A self user user N/A N/A self password password N/A connect N/A N/A self N/A N/A N/A Connect to the database.
         N/A NotImplementedError N/A close N/A N/A self N/A N/A N/A Close the database connection.
         N/A NotImplementedError N/A commit N/A N/A self N/A N/A N/A Commit the changes to the database.
         N/A NotImplementedError N/A rollback N/A N/A self N/A N/A N/A Rollback all the changes made since the last commit.
         N/A NotImplementedError N/A run_in_transaction N/A N/A self func N/A args kw N/A N/A A helper function to run the specified func in a transaction. This
        function is provided as a convenient method to manage transaction by
        some database engines, especially the GAE engine.
        
        Example usage::
            
            def some_function(a, b, c):
                u = User(name="some")
                u.lang = "fr_FR"
                u.save()
                
            db.run_in_transaction(some_function, 1, 2, c=4)
            
        :param func: the callable to be run in transaction
        :param args: positional arguments to be passed to the function
        :param kw: keyword arguments to be passed to the function
        
        :returns: result of the function
        :raises: any exception thrown during function execution
         N/A N/A N/A res N/A func args kw N/A N/A N/A N/A N/A N/A self rollback N/A N/A N/A N/A N/A self commit N/A res N/A schema_table N/A N/A self model N/A N/A N/A Returns the schema information of the table for the given model.

        :param model: a subclass of :class:`Model`

        :returns: textual representaion of the model in the database
         N/A NotImplementedError N/A exists_table N/A N/A self model N/A N/A N/A Check whether the table exists or not.

        :param model: a subclass of :class:`Model`

        :returns: True if table exists else False
         N/A NotImplementedError N/A create_table N/A N/A self model N/A N/A N/A Create a table for the given model if it doesn't exist.

        :param model: a subclass of :class:`Model`
         N/A NotImplementedError N/A alter_table N/A N/A self model name N/A None N/A N/A Alter the table associated for the given model. If name is given look
        for the table by that name (if model class name has been changed).

        :param model: a subclass of :class:`Model`
        :param name: if given, should be the name of table
         N/A NotImplementedError N/A drop_table N/A N/A self model N/A N/A N/A Drop the table

        :param model: a subclass of :class:`Model`
         N/A NotImplementedError N/A update_records N/A N/A self instance N/A args N/A N/A Update database records for the given model instances.

        The implementation should take care of:

            - Inserting records if records doesn't exist.
            - Updating `key` value of the given model instances.

        :param instance: an instance of :class:`Model` subclass
        :param args: more instances

        :returns: list of key values
        :raises:
            - :class:`DatabaseError`
            - :class:`IntegrityError`
         N/A NotImplementedError N/A delete_records N/A N/A self instance N/A args N/A N/A Delete database records for the given model instances. This method
        also accepts keys.

        The implementation should take care of:

            - Updating `key` value of the given model instances to None.

        :param instance: a Model instance or a record key
        :param args: more Model instances or record keys

        :returns: list of key values which have been deleted.
        :raises:
            - :class:`DatabaseError`
            - :class:`IntegrityError`
         N/A NotImplementedError N/A fetch N/A N/A self qset limit offset N/A N/A N/A Fetch records from database filtered by the given query set bound
        to given limit and offset.

        For more information on query set, see :class:`db.query.QSet`.

        The implementation should return an iterator or generator of dict
        having ``name``, ``value`` mapping including ``key`` information.

        Database engine specific information can be passed with ``_payload``
        which will be stored as an attribute to the model instance.

        :param qset: the query set, an instance of :class:`db.query.QSet`
        :param limit: number of records to be fetch
        :param offset: offset from where to fetch records

        :returns: an interator of dict of name, value mappings
        :raises:
            - :class:`db.DatabaseError`
         N/A NotImplementedError N/A count N/A N/A self qset N/A N/A N/A Returns the total number of records matched by given query set.

        :param qset: the query set, an instance of :class:`db.query.QSet`

        :returns: integer, total number of records
        :raises:
            - :class:`DatabaseError`
         N/A NotImplementedError N/A N/A