def __init__(self,
                 database=None,
                 autocommit=False,
                 hostname=None,
                 username="******",
                 password="******",
                 host=None,
                 user=None,
                 dsn=None):
        """ Initializes the MonetDBLite database.
        args:
            database (str): path to the database directory
            autocommit (bool):  enable/disable auto commit (default: False)

            Ignored Parameters: hostname, username, password, host, user, dsn
        returns:
            Connection object
        """
        global MONETDBLITE_CURRENT_DATABASE
        if database is None:
            if not embeddedmonetdb.is_initialized():
                raise Exception(
                    "No database supplied and MonetDBLite was not initialized")
        elif database != embeddedmonetdb.dbpath():
            if embeddedmonetdb.is_initialized():
                raise Exception(
                    "MonetDBLite is already initialized. Close the previous connection first."
                )
            embeddedmonetdb.init(database)
            MONETDBLITE_CURRENT_DATABASE = database

        self.__monetdblite_connection = embeddedmonetdb.connect()
        self.set_autocommit(autocommit)
        self.replysize = 1
        self.__cursors = []
Beispiel #2
0
def connectclient(*args, **kwargs):
    return embeddedmonetdb.connect(*args, **kwargs)
def connect(*args, **kwargs):
    # return Connection(*args, **kwargs)
    return embeddedmonetdb.connect()