Questions tagged [pysqlite]

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

140 questions
3
votes
1 answer

How to tell whether an update statement is successful in pysqlite 2.6.3

I'm using pysqlite to talk to a SQLite db, and I wonder what is the right way to check whether an UPDATE SQL statement has actually successfully update something in a table. Is there a variable I can quickly check after the execution for this in…
MLister
  • 10,022
  • 18
  • 64
  • 92
3
votes
2 answers

Serialising a list into SQLite

I am working with over 29 million elements, so thought a database would make more sense than an array. Previously I was passing elements one at a time to the execute function, but I believe passing an array of 100,000 elements at a time to the…
user1438003
  • 6,603
  • 8
  • 30
  • 36
3
votes
4 answers

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 =…
Strider1066
  • 101
  • 1
  • 5
2
votes
0 answers

sqlite3.OperationalError: no such column

The following works in SQLite Manager, but doesn't in Python. I get the following error: sqlite3.OperationalError: no such column: domain_list.short_name I've tried taking out the "AS domain_list" and referring to just "short_name" and also…
alj
  • 2,839
  • 5
  • 27
  • 37
2
votes
5 answers

Future Development in Python 2.4

I'm starting a new python project at work that is targeted primarily at RHEL5 machines that may be upgraded to RHEL6 in couple years. Given that python 2.4 is standard on RHEL5 and the system admins won't support more than they have to, getting…
cdated
  • 1,753
  • 1
  • 14
  • 24
2
votes
2 answers

Media Folder Configuration path not found in django

I am using MYSQL for the database. I want to upload my imagefield files in media folder that I have created in my project. I am getting "empty path didn't exist". settings.py MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL =…
2
votes
2 answers

Unable to compile PIL/pysqlite after OS X 10.7 Lion upgrade

After Lion upgrade, I had to reinstall my python packages, and ran into problem installing PIL and pysqlite. ... unable to execute gcc-4.2: No such file or directory error: command 'gcc-4.2' failed with exit status 1
Dolan Antenucci
  • 15,432
  • 17
  • 74
  • 100
2
votes
1 answer

how to execute .sql file using pyodbc connection

I have a folder which contains SQL files. I want to execute all these SQL files using a pyodbc connection. I tried different ways but I am still facing some issues. My code looks like below. import os import pyodbc conn = …
Chanukya
  • 5,833
  • 1
  • 22
  • 36
2
votes
1 answer

Correct way to "select * from tbl where field in ?" and the placeholder is a list without string interpolation

I have a query of this form using pysqlite: query = "select * from tbl where field1 in ?" variables = ['Aa', 'Bb'] In a query, I'd like this to work: with conn.cursor() as db: res = db.execute(query, (variables,)).fetchall() eg, interpreted into…
Mittenchops
  • 18,633
  • 33
  • 128
  • 246
2
votes
1 answer

What's the difference between database object and cursor object in pysqlite2?

In Python one may interact with an sqlite database using the pysqlite2 class. from pysqlite2 import dbapi2 as sqlite One way to send commands to the database is through the database object: db = sqlite.connect('mydb.sqlite') db.execute('CREATE TABLE…
Boris Gorelik
  • 29,945
  • 39
  • 128
  • 170
2
votes
2 answers

Error while Installing sqlite using pip on Python 2.7.13

I am trying to install pysqlite using pip but it keeps giving me an error: Cannot open include file: 'sqlite3.h': No such file or directory I'm using Windows 10 OS 64 bit. Python version 2.7.13. I'm trying to install using pip. (pip install…
2
votes
1 answer

Recovering database rows from an uncommitted transaction

We have a database that was written to by a program written in Python that uses the sqlite3 module. The database had a large number of insert statements executed on it, but the transaction was never ended by a commit. The result is that we have two…
pancakes
  • 741
  • 1
  • 7
  • 15
2
votes
1 answer

'sqlite3.h': No such file or directory

I am attempting to install the pysqlite module for Python 2.7 on my Windows 10 computer. I issued the following command: pip install pysqlite The installation ran as usual until it hit an…
xaresys
  • 31
  • 1
  • 3
  • 7
2
votes
1 answer

How can I return a single element in a tuple returned by .fetchone()?

I'm using PyMySQL to ping a Database and get the values back. I am doing that like so: cursor.execute(/*SQL Statement*/) result = cursor.fetchone() print (result) I tested this and it works fine. Now the problem is I'm trying to get just the first…
Isabel Alphonse
  • 539
  • 1
  • 8
  • 14
2
votes
1 answer

How should I parameterize column names in pysqlite to avoid SQL Injection

I want the user to be able to choose what order results are displayed e.g. by age), and I don't want to sort them after getting them from the database. Obviously if the user is able to specify input that affects SQL commands, it needs to be…
Grezzo
  • 2,220
  • 2
  • 22
  • 39