pysqlite

Python pysqlite not accepting my qmark parameterization

I think I am being a bonehead, maybe not importing the right package, but when I do... from pysqlite2 import dbapi2 as sqlite import types import re import sys ... def create_asgn(self): stmt = "CREATE TABLE ? (login CHAR(8) PRIMARY KEY NOT NULL, grade INTEGER NOT NULL)" stmt2 = "insert into asgn values ('?', ?)" sel...

pysqlite user types in select statement

Using pysqlite how can a user-defined-type be used as a value in a comparison, e. g: “... WHERE columnName > userType”? For example, I've defined a bool type with the requisite registration, converter, etc. Pysqlite/Sqlite responds as expected for INSERT and SELECT operations (bool 'True' stored as an integer 1 and returned as True). B...

Django on CentOS

I'm looking to use Django on a shared host that's running an unknown version of CentOS. My main problem is trying to interface with a database. The server has MySQL installed, but not MySQL-python. I initially thought of suggesting running "yum install MySQL-python", but apparently the version of MySQL-python that's in the default reposi...

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, especially when exceptions can happen in the calling code. I'm considering using the __de...

Problem with SQLite executemany

I can't find my error in the following code. When it is run a type error is given for line: cur.executemany(sql % itr.next()) => 'function takes exactly 2 arguments (1 given), import sqlite3 con = sqlite3.connect('test.sqlite') cur = con.cursor() cur.execute("create table IF NOT EXISTS fred (dat)") def newSave(className, fields, objD...

Shall I bother with storing DateTime data as julianday in SQLite?

SQLite docs specifies that the preferred format for storing datetime values in the DB is to use Julian Day (using built-in functions). However, all frameworks I saw in python (pysqlite, SQLAlchemy) store the datetime.datetime values as ISO formatted strings. Why are they doing so? I'm usually trying to adapt the frameworks to storing d...

How to install pysqlite?

Hi all, I am trying to install pysqlite (Python interface to the SQLite). I downloaded the file with the package (pysqlite-2.5.5.tar.gz). And I did the following: gunzip pysqlite-2.5.5.tar.gz tar xvf pysqlite-2.5.5.tar \cd pysqlite-2.5.5 python setup.py install At the last step I have a problem. I get the following error message: er...

How to build sqlite for Python 2.4?

I would like to use pysqlite interface between Python and sdlite database. I have already Python and SQLite on my computer. But I have troubles with installation of pysqlite. During the installation I get the following error message: error: command 'gcc' failed with exit status 1 As far as I understood the problems appears because ...

Why pysqlite does not work properly?

I tried to install pysqlite. Some suspicious things start to appear during the installation. Why I typed: python setup.py build I got the following message in the end: src/module.c:286: error: ‘SQLITE_PRAGMA’ undeclared here (not in a function) src/module.c:287: error: ‘SQLITE_READ’ undeclared here (not in a function) src/module.c:28...

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 are doing and how to install them). Can anybody, pleas, help me with that? ...

How should I handle software packages?

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. My platform: CentOS release 5.3 (Final). I have Python-2.6.2. I also found out that I need .rpm files. As far as I have them I execute: rpm -i sqlite3-devel-3.n.n.n.rpm a...

Why my python does not see pysqlite?

I would like to have an interface between Python and sqlite. Both are installed on the machine. I had an old version of Python (2.4.3). So, pysqlite was not included by default. First, I tried to solve this problem by installing pysqlite but I did not succeed in this direction. My second attempt to solve the problem was to install a new ...

How to get _sqlite3.so file?

I have installed Python 2.6.2.. I did it "locally" since I do not have root permissions. With this version of Python I wanted to use module called "sqlite3" (it is called "pysqlite" in earlier versions). In theory I had to be able to use this module without any problems since it is supposed to be included by default in the considered ve...

How can I make Python see sqlite?

I cannot use sqlite3 (build python package). The reason of that is missing _sqlite3.so file. I found that peoples had the same problem and they resolved it here. To solve my problem I have to "install sqlite3 and recompile Python". I also found out that the problem can be solved by "building from source and moving the library to /usr/lib...

What is a difference between "sqlite" and "pysqlite2/sqlite3" modules?

I gave up to make "sqlite3" working but I just found out (with help("modules")) that I have "sqlite" module. I tested it (create table, insert some values and so on) and it works fine. But before I start to use this module I would like to know if it has some significant limitations in comparison with sqlite3 module? Can anybody, pleas, g...

Detect the FTS3 extension in SQLite3

What is the SQLite query to detect if the FTS3 extension module is installed? Or is it possible to get a list of installed extensions with an SQLite3 query? It has to work with pysqlite2. I know that I can get the list of tables using SELECT * FROM sqlite_master, I'd like to get something similar for the list of extensions. I also know ...

What are the differences among sqlite3 from python2.5, pysqlite and apsw

Hi, 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 them into windows/system32 folder and put sqlite3.dll into c:/python25/Lib folder do...

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 real)''') connection.commit() cur.close() I'm catching this exception: Traceback (most recent call last): Fi...

Change text_factory in Django/sqlite

I have a django project that uses a sqlite database that can be written to by an external tool. The text is supposed to be UTF-8, but in some cases there will be errors in the encoding. The text is from an external source, so I cannot control the encoding. Yes, I know that I could write a "wrapping layer" between the external source and ...

Can I get the raw SQL generated by a prepared statement in Python’s sqlite3 module?

If so, how can I do this? ...