473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

pysqlite problem

Hello,

I'm getting the following error:

pysqlite2.dbapi2.OperationalError: no such table: tbl1

Here's my code:

from pysqlite2 import dbapi2 as sqlite
con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES)
cur = con.cursor()
cur.execute("select * from tbl1")
data = cursor.fetchall()
for record in date:
record[0], record[1]

my installation versions:

python 2.4.2
pysqlite 2.0.7
sqlite 3.3.4

I checked to make sure I have a table called tbl1. I don't understand
what's going on. Any ideas?

Mar 1 '06 #1
6 1955
my bad. that was the wrong code, here is my code:

from pysqlite2 import dbapi2 as sqlite
con = sqlite.connect("ex1")
cur = con.cursor()
cur.execute("select * from tbl1")
print cur.fetchall()

Mar 1 '06 #2
Is it the complete code ?

If so then you have to create the table each time you connect to the
DB.

You use an in-memory DB (":memory:") so all the data of the DB is lost
when you close the connection, including the schema of the DB.

Mar 1 '06 #3
OK, it's better.

You use relative path to your file 'ex1', are you really sure that you
open the right file and not creating another DB in another path ?

Try to use absolute path (r'c:\temp\ex1').

Mar 1 '06 #4
ba*****@gmail.com wrote:
I'm getting the following error:

pysqlite2.dbapi2.OperationalError: no such table: tbl1

Here's my code:

from pysqlite2 import dbapi2 as sqlite
con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES)
cur = con.cursor()
cur.execute("select * from tbl1")
data = cursor.fetchall()
for record in date:
record[0], record[1]

my installation versions:

python 2.4.2
pysqlite 2.0.7
sqlite 3.3.4

I checked to make sure I have a table called tbl1.
where?
I don't understand what's going on. Any ideas?


last time I checked, connect(":memory:") creates a new blank database
every time it is called.

</F>

Mar 1 '06 #5
>>>>> bapolis <ba*****@gmail.com> writes:
con = sqlite.connect(":memory:", detect_types=sqlite.PARSE_COLNAMES)

^^^^^^^^^^

Did you really intend this? Since you're opening a database in memory, you
will have access to tbl1 only if you create the table after the connect.

Ganesan

--
Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA
Web: http://employees.org/~rganesan | http://rganesan.blogspot.com
Mar 1 '06 #6
I tried using the path "c:\ex1.db" and it worked. I was using "ex1.db"
before.

Thanks everyone for the help. This is a great community and maybe next
time I will ask a harder question :)

Mar 1 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Abel | last post by:
I'm having a problem building pysqlite. I've downloaded the sqlite_source.zip, and sqlitedll.zip and extracted them to a directory. I've then extracted pysqlite-0.4.3. I've run the lib command,...
8
by: Martin Maney | last post by:
Apologies if this isn't news here - I've been too busy this last week or so for even skimming the traffic here, in part because I've been messing around with Ubuntu's preview release on a spare...
6
by: Rob Cowie | last post by:
Hi all, I'm having difficulty installing pysqlite 2.1.3 on Mac OS X 10.4.4 There are some notes on the pysqlite wiki regarding modification of the setup.py script and I've followed them to no...
1
by: DurumDara | last post by:
Hi ! I have this code in my program. Before this I use APSW, but that project's connection object doesn't have close method... .... crs.execute(*'''create table files (*f_id integer not null...
8
by: rdrink | last post by:
I am just getting into pysqlite (with a fair amount of Python and MySQL experience behind me) and have coded a simple test case to try to get the hang of things... yet have run into a 'stock...
1
by: Thomas | last post by:
Hi there! Installing TurboGears out-of-the-box (egg-based) on Windows doesn't work because I can't compile the extensions needed for the required pysqlite (also egg- based): Installed...
14
by: Nader Emami | last post by:
I have installed "TurboGears" and I would install 'pysqlite' also. I am a user on a Linux machine. If I try to install the 'pysqlite' with 'easy_install' tool I get the next error message. The...
5
by: =?ISO-8859-1?Q?Gerhard_H=E4ring?= | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 pysqlite 2.5.0 released ======================= I'm pleased to announce the availability of pysqlite 2.5.0. This is a release with major new...
4
by: Tilman Kispersky | last post by:
I am trying to install sqlite for use with python on cygwin. I have installed the sqlite packages from cygwin (that is libsqlite3-devel and libsqlite3_0). When attempting to easy_install pysqlite...
15
by: Kurda Yon | last post by:
Hi, I try to "build" and "install" pysqlite? After I type "python setup.py build" I get a lot of error messages? The first error is "src/ connection.h:33:21: error: sqlite3.h: No such file or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.