def _connect(self): if mariadb is None: raise ImproperlyConfigured('mariadb connector not installed!') self.connect_params.pop('charset', None) self.connect_params.pop('sql_mode', None) self.connect_params.pop('use_unicode', None) return mariadb.connect(db=self.database, **self.connect_params)
def _connect(self, database, **kwargs): if not pymssql: raise ImproperlyConfigured('pymssql must be installed') if kwargs.pop('use_legacy_datetime', False): self.field_overrides['datetime'] = 'datetime' self.field_overrides['date'] = 'nvarchar(15)' self.field_overrides['time'] = 'nvarchar(10)' return pymssql.connect(database=database, **kwargs)
def _connect(self): if mysql_connector is None: raise ImproperlyConfigured('MySQL connector not installed!') conn = mysql_connector.connect(db=self.database, **self.connect_params) if self._server_version is None: # MySQL-Connector supports getting the version as a tuple, but this # method does not return the proper MariaDB version on systems like # Ubuntu, which express the version as 5.5.5-10.0.37-MariaDB-... version_raw = conn.get_server_info() self._server_version = self._extract_server_version(version_raw) return conn
def _connect(self, database, **kwargs): if not PYSQLITE_BERKELEYDB: message = ('Your Python SQLite driver (%s) does not appear to ' 'have been compiled against the BerkeleyDB SQLite ' 'library.' % berkeleydb) if LIBSQLITE_BERKELEYDB: message += (' However, the libsqlite on your system is the ' 'BerkeleyDB implementation. Try recompiling ' 'pysqlite.') else: message += (' Additionally, the libsqlite on your system ' 'does not appear to be the BerkeleyDB ' 'implementation.') raise ImproperlyConfigured(message) conn = berkeleydb.connect(database, **kwargs) conn.isolation_level = None self._add_conn_hooks(conn) return conn
def _connect(self): if mysql_connector is None: raise ImproperlyConfigured('MySQL connector not installed!') return mysql_connector.connect(db=self.database, **self.connect_params)
def _connect(self, database, **kwargs): if not pyodbc: raise ImproperlyConfigured( 'pyodbc should be installed in order to use peewee_mssql') return pyodbc.connect(kwargs['string'] + ';DATABASE=%s' % database)
def _connect(self, **kwargs): if pycovenantsql is None: raise ImproperlyConfigured('pycovenantsql driver not installed!') conn = pycovenantsql.connect(database=self.database, **self.connect_params) return conn