Questions tagged [pysqlite]

A DB-API2 compliant module in Python for interacting with a SQLite relational database.

140 questions
68
votes
23 answers

Python SQLite: database is locked

I'm trying this code: import sqlite connection = sqlite.connect('cache.db') cur = connection.cursor() cur.execute('''create table item (id integer primary key, itemno text unique, scancode text, descr text, price…
Soid
  • 2,585
  • 1
  • 30
  • 42
19
votes
3 answers

Why can't pip uninstall pysqlite?

I'm trying to remove pysqlite from my system using pip. What I get doing so makes no sense: $ pip uninstall pysqlite The command worked, but watch this: $ pip freeze [...] pysqlite==1.0.1 Let's try again $ pip uninstall pysqlite Can't uninstall…
shkschneider
  • 17,833
  • 13
  • 59
  • 112
18
votes
2 answers

pysqlite: Placeholder substitution for column or table names?

Using pysqlite I am making a procedure to do something with some data. The same kind of operation is done on similar fields in multiple tables and columns, so I thought I could parameterize the sql statement as shown below: def foo(): column =…
porgarmingduod
  • 7,668
  • 10
  • 50
  • 83
17
votes
2 answers

I can't get Python's executemany for sqlite3 to work properly

I was trying to use executemany to insert values into a database, but it just won't work for me. Here is a sample: clist = [] clist.append("abc") clist.append("def") clist.append("ghi") cursor.executemany("INSERT INTO myTable(data) values (?) ",…
brainydexter
  • 19,826
  • 28
  • 77
  • 115
16
votes
3 answers

"%s" % format vs "{0}".format() vs "?" format

In this post about SQLite, aaronasterling told me that cmd = "attach \"%s\" as toMerge" % "b.db" : is wrong cmd = 'attach "{0}" as toMerge'.format("b.db") : is correct cmd = "attach ? as toMerge"; cursor.execute(cmd, ('b.db', )) : is right…
prosseek
  • 182,215
  • 215
  • 566
  • 871
15
votes
5 answers

WARNING: IPython History requires SQLite, your history will not be saved

Hi I'm using Ubuntu release 12.10 (quantal) 32-bit with Linux Kernel 3.5.0-21-generic. I'm trying to get IPython's History to work. I've set it up using pythonbrew and a virtual environment. In there I use pip to install IPython. Currently, when I…
PythonJin
  • 4,034
  • 4
  • 32
  • 40
13
votes
4 answers

How to use the latest sqlite3 version in python

I need to use sqlite version 3.8 or higher with python in Amazon Linux. I updated my sqlite installation to the latest version: $ sqlite3 -version 3.22.0 2018-01-22 18:45:57 0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2171d I also…
jrauhamaa
  • 321
  • 1
  • 2
  • 11
13
votes
5 answers

pysqlite2: ProgrammingError - You must not use 8-bit bytestrings

I'm currently persisting filenames in a sqlite database for my own purposes. Whenever I try to insert a file that has a special character (like é etc.), it throws the following error: pysqlite2.dbapi2.ProgrammingError: You must not use 8-bit…
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411
13
votes
3 answers

pysqlite's IntegrityError: distinguish 'NOT NULL' from 'UNIQUE' violation

In pysqlite, violating a NOT NULL or a UNIQUE constraint likewise raise an IntegrityError. Unfortunately, this Exception type does not provide an error code, but only a message. So, let's say I want to ignore unique-constraint violations, because I…
lenz
  • 5,658
  • 5
  • 24
  • 44
12
votes
3 answers

Symbol not found: _sqlite3_enable_load_extension - sqlite installed via homebrew

Symptom: In my Django app, when I call from pysqlite2._sqlite import * I get the traceback Symbol not found: _sqlite3_enable_load_extension when Background: I've installed python using homebrew (python 2.7.13), which auto installed sqlite I am…
Xiao Wei Chen
  • 103
  • 1
  • 11
12
votes
3 answers

What are sqlite development headers and how to install them?

I am trying to install pysqlite and have troubles with that. I found out that the most probable reason of that is missing sqlite headers and I have to install them. However, I have no ideas what these headers are (where I can find them, what they…
Verrtex
  • 4,317
  • 9
  • 34
  • 33
11
votes
4 answers

Jupyter missing _sqlite3 and pysqlite2

trying to get jupyter (ipython3) running on Python3.5, I installed it using sudo pip3 install jupyter However, when trying to launch jupyter notebook I receive the error that the modules _sqlite3 and pysqlite2 are missing. I tried installing them…
Suppenkasper
  • 845
  • 4
  • 10
  • 29
10
votes
3 answers

Install Spatialite for python (GeoDjango) on OS X

I am tearing my hair out trying to install Spatialite for GeoDjango! I am already using Homebrew, it's generally easy and convenient so I initially tried to follow the Homebrew instructions for GeoDjango. But this stops short of installing any…
Anentropic
  • 32,188
  • 12
  • 99
  • 147
10
votes
1 answer

ImportError: No module named pysqlite2

Why does from pysqlite2 import dbapi2 as sqlite cause ImportError: No module named pysqlite2 Isn't pysqlite2 already installed in Python 2.6.5?
jacknad
  • 13,483
  • 40
  • 124
  • 194
9
votes
2 answers

Cleaning up an internal pysqlite connection on object destruction

I have an object with an internal database connection that's active throughout its lifetime. At the end of the program's run, the connection has to be committed and closed. So far I've used an explicit close method, but this is somewhat cumbersome,…
Eli Bendersky
  • 263,248
  • 89
  • 350
  • 412
1
2 3
9 10