def __init__(self, database_url: typing.Union[DatabaseURL, str], **options: typing.Any) -> None: self._database_url = DatabaseURL(database_url) self._options = options self._dialect = pysqlite.dialect(paramstyle="qmark") # aiosqlite does not support decimals self._dialect.supports_native_decimal = False self._pool = SQLitePool(self._database_url, **self._options)
def thr_execute(self, txn): stmt = sql.select([self.table]) compiled = stmt.compile(dialect=pysqlite.dialect(paramstyle="named")) raw_sql = unicode(compiled) self.log.debug('sql: %s', repr(raw_sql)) txn.execute(raw_sql) result = txn.fetchall() return result
def thr_execute(self, txn, **data): stmt = sql.insert(self.table).values(**data) compiled = stmt.compile(dialect=pysqlite.dialect(paramstyle="named")) raw_sql = unicode(compiled) params = compiled.params self.log.debug(' sql: %s , params: %s', repr(raw_sql), params) try: txn.execute(raw_sql, params) except: raise return None
def test_file_path_is_absolute(self): d = pysqlite_dialect.dialect() eq_( d.create_connect_args(make_url('sqlite:///foo.db')), ([os.path.abspath('foo.db')], {}) )
def test_file_path_is_absolute(self): d = pysqlite_dialect.dialect() eq_(d.create_connect_args(make_url('sqlite:///foo.db')), ([os.path.abspath('foo.db')], {}))
def __init__(self, database_url: typing.Union[DatabaseURL, str]) -> None: self._database_url = DatabaseURL(database_url) self._dialect = pysqlite.dialect(paramstyle="qmark") self._pool = SQLitePool(self._database_url)
def __init__(self, database_url: DatabaseURL) -> None: self._database_url = database_url self._dialect = pysqlite.dialect(paramstyle="qmark") self._pool = SQLitePool(database_url)