Questions tagged [apsw]

APSW is a thin Python wrapper over the SQLite API.

APSW is not fully compatible with Python's DBAPI in order to completely support all SQLite features.

References

37 questions
6
votes
4 answers

How can strings with non-ASCII characters be retrieved with OptParse?

I'm using the OptParse module to retrieve a string value. OptParse only supports str typed strings, not unicode ones. So let's say I start my script with: ./someScript --some-option ééééé French characters, such as 'é', being typed str, trigger…
user610650
6
votes
5 answers

Use SQLite's backup API from Python/SQLAlchemy

I'm using an SQLite database from python (with SQLAlchemy). For performance reasons, I'd like to populate an in-memory database in the application, and then back up that database to disk. SQLite has a backup API, which seems would do this…
Ryan Ginstrom
  • 13,915
  • 5
  • 45
  • 60
5
votes
2 answers

Firefox locks places.sqlite

Platform: Firefox 3.6.13, Python 2.7 stackless, and Windows 7 (not yet tested on Ubuntu, I will...) I tried with the apsw library: conn = apsw.Connection( dir + profile + '/places.sqlite', apsw.SQLITE_OPEN_READONLY ) And I got the error: File…
Massimo
  • 3,171
  • 3
  • 28
  • 41
5
votes
2 answers

What are the differences among SQLite3 from Python2.5, pysqlite, and APWS

I would like to know the differences among SQLite3 from Python2.5, pysqlite, and APSW? I have a bumpy run when trying to install pysqlite on Windows Vista with python2.5, see following: Download SQLite from http://sqlite.org/download.html and unzip…
leo
  • 547
  • 6
  • 11
4
votes
3 answers

Join with Pythons SQLite module is slower than doing it manually

I am using pythons built-in sqlite3 module to access a database. My query executes a join between a table of 150000 entries and a table of 40000 entries, the result contains about 150000 entries again. If I execute the query in the SQLite Manager it…
Björn Pollex
  • 75,346
  • 28
  • 201
  • 283
3
votes
2 answers

Reproduce pysqlite's row_factory on apsw

I have been trying to migrate away from pysqlite to apsw but I can't find a way to reproduce its row_factory function. this is my original code: connection = sqlite3.connect("db.db3") connection.row_factory = sqlite3.Row cursor =…
relima
  • 3,462
  • 5
  • 34
  • 53
3
votes
4 answers

APSW (or SQLite3) very slow INSERT on executemany

I have found the following issue with APSW (an SQLite parser for Python) when inserting lines. Lets say my data is data = [[1,2],[3,4]] APSW and SQLite3 allow me to do something like: apsw.executemany("INSERT INTO Table VALUES(?,?)", b) or I can…
Yona
  • 571
  • 7
  • 23
3
votes
1 answer

Matching row values obtained from first table to the column names of second table without loop

It will be really helpful for me if someone can solve the following problem. I have two tables and a requirement- Required SQL script: Without using loops, an efficient SQL script to match row values (sampleID) obtained from first table to the…
TJC
  • 43
  • 5
2
votes
2 answers

"BusyError: cannot rollback savepoint - SQL statements in progress" when using SQLite with APSW

I'm working with an SQLite database using the Python apsw bindings. The code goes like this: with apsw.Connection(path) as t: c = t.cursor() c.execute(...) ... more code ... if c.execute(...).next()[0]: raise Exception I…
Mikhail Edoshin
  • 2,639
  • 16
  • 25
2
votes
2 answers

3 Questions involving Python and SQLite

I'm creating functions for use with a game server. This server uses plugins. I have these functions which use an SQLite database, along with apsw to retrieve items stored by another function. I have 3 questions on this. Question One: I keep getting…
Vortol
  • 21
  • 2
2
votes
2 answers

Column data type affected by usage of it elsewhere

I can't seem to find a reference to the following behavior either in SQLite or apsw docs: I have a table partially defined and populated as: CREATE TABLE GeoLoc (lat TEXT, lon TEXT); INSERT INTO GeoLoc (lat, lon) VALUES ('-33.5533422',…
Mansour
  • 1,787
  • 2
  • 20
  • 33
2
votes
2 answers

How do you create an index on the tables themselves in a database?

I'm using APSW to wrap my SQL code in Python, like so: connection=apsw.Connection("dbfile"); cursor=connection.cursor() cursor.execute("create table foo(x,y,z)") cursor.execute("create table bar(a,b,c)") cursor.execute("create table…
Noob Saibot
  • 4,573
  • 10
  • 36
  • 60
2
votes
1 answer

How to use APSW with Flask

I have a sqlite3 database but the database is only getting updated when I restart the Flask server. I think it is because I don't tell Flask that it is a database. So I started using SQLAlchemy and set db = SQLAlchemy(app) but SQLAlchemy uses…
Siecje
  • 3,594
  • 10
  • 32
  • 50
1
vote
1 answer

sqlite, python, apsw: trouble parameterizing nested select

I am trying to query some data of an sqlite database with a nested select statement. The final result of the query needs to be restricted by a WHERE clause, so I put brackets around the "inner" select statement, named it s1, and put another select…
Judith
  • 11
  • 1
1
vote
1 answer

Intellisense for Python APSW

System specs Windows 10 Pro x64 Python 3.10.2 x64 APSW 3.37.0 Visual Studio Code 1.63.2 Intellisense works for Python and all imported modules except for APSW. APSW does work, and executing dir(apsw) Will yield all constants, functions, properties,…
njc
  • 128
  • 2
  • 8
1
2 3