Beispiel #1
0
 def open(self, configuration):
     """Open the connexion."""
     host = configuration["host"]
     port = configuration["port"]
     dbuser = configuration["dbuser"]
     dbpass = configuration["dbpass"]
     dbname = configuration["dbname"]
     self.connection = postgresql.open(
             "pq://{user}:{password}@{host}:{port}/{database}".format(
             user=dbuser, password=dbpass, host=host, port=port,
             database=dbname))
     SQLDriver.open(self, configuration)
Beispiel #2
0
    def open(self, configuration):
        """Open the connexion."""
        location = configuration["location"]
        location = location.replace("\\", "/")
        if location.startswith("~"):
            location = os.path.expanduser("~") + location[1:]
        parent = os.path.dirname(location)
        if not os.path.exists(parent):
            os.makedirs(parent)

        if not os.access(parent, os.R_OK):
            raise exceptions.DriverInitializationError(
                    "cannot read in {}".format(parent))
        if not os.access(parent, os.W_OK):
            raise exceptions.DriverInitializationError(
                    "cannot write in {}".format(parent))

        self.location = location
        self.connection = sqlite3.connect(self.location)
        SQLDriver.open(self, configuration)
Beispiel #3
0
 def __init__(self):
     SQLDriver.__init__(self)
     self.format = "${}"
Beispiel #4
0
 def __init__(self):
     SQLDriver.__init__(self)
     self.location = None