473,385 Members | 2,005 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,385 software developers and data experts.

couple more questions about sqlite

I've been looking around and reading, and I have a few more questions
about SQLite in particular, as it relates to Python.

1. What is the current module to use for sqlite? sqlite3? or is that not
out until Python 2.5?

2. What's the difference between sqlite and pysqlite? Do you need both,
just one, or is one an older version of the same thing?

3. What's the difference between the command line program called sqlite3
and the module you would use with Python? (I know that the former let's
you do normal database things without dealing with Python, but is it
necessary if you are using Python to interact with the DB?)

Thanks!
Aug 18 '06 #1
12 2446
2. What's the difference between sqlite and pysqlite? Do you need both,
just one, or is one an older version of the same thing?
To access your database from python you need both (or some alternative
to pysqlite)
3. What's the difference between the command line program called sqlite3
and the module you would use with Python? (I know that the former let's
you do normal database things without dealing with Python, but is it
necessary if you are using Python to interact with the DB?)
slqite comes with a library which other programs can call, and a
command line interface
that you can use from the shell. pysqlite needs the library but I
don't think it is possible
to get one without the other.

Regards,
Andy

Aug 18 '06 #2
an**************@yahoo.co.uk wrote:
>2. What's the difference between sqlite and pysqlite? Do you need both,
just one, or is one an older version of the same thing?

To access your database from python you need both (or some alternative
to pysqlite)
I can understand this in terms of MySQL being one thing, and mysqldb
being the necessary module for Python to use MySQL. But in 2.5, for
example, which comes with sqlite3, is this all you need, or do you still
need pysqlite? Or are these two different things that can access the
sqlite system? (I guess I kind of thought there would be just one
standard module used for each type of database, such as mysqldb being
the one used for MySQL.)
Aug 18 '06 #3
John Salerno wrote:
an**************@yahoo.co.uk wrote:
2. What's the difference between sqlite and pysqlite? Do you need both,
just one, or is one an older version of the same thing?
To access your database from python you need both (or some alternative
to pysqlite)

I can understand this in terms of MySQL being one thing, and mysqldb
being the necessary module for Python to use MySQL. But in 2.5, for
example, which comes with sqlite3, is this all you need, or do you still
need pysqlite? Or are these two different things that can access the
sqlite system? (I guess I kind of thought there would be just one
standard module used for each type of database, such as mysqldb being
the one used for MySQL.)
Your confusion is quite understandable. I started looking at sqlite
when the announcement that it would be included in Python 2.5 came out.
Puzzlement reigned. I ended up with the following up the front of my
experimental module:

import sys
PY_VERSION = sys.version_info[:2]
if PY_VERSION >= (2, 5):
import sqlite3
else:
from pysqlite2 import dbapi2 as sqlite3
print "Python :", sys.version
print "pysqlite:", sqlite3.version
print "sqlite :", sqlite3.sqlite_version

Interestingly, at the time pysqlite2 was providing a version of the
underlying C library that was 2.4-compatible but *later* than the
version that came with 2.5a2 [I haven't checked since].

So, if you want to try out sqlite now, download pysqlite2 and use it
with Python 2.4. If you have the 2.5 release candidate, you can try
your code with it as well, using version-detecting code along the above
lines.

I would strongly recommend for a learner of SQL and the Python DBAPI:
(1) start with sqlite; it's great, and there's minimal admin involved
(2) download the command-line utility from the sqlite website -- you'll
need it for the minimal admin, plus it's handy for quick one-line SQL
statements, peeking at the schema, etc.

HTH,
John

Aug 18 '06 #4
"John Machin" <sj******@lexicon.netwrote in message
news:11**********************@74g2000cwt.googlegro ups.com...
I would strongly recommend for a learner of SQL and the Python DBAPI:
(1) start with sqlite; it's great, and there's minimal admin involved
(2) download the command-line utility from the sqlite website -- you'll
need it for the minimal admin, plus it's handy for quick one-line SQL
statements, peeking at the schema, etc.
I've also become a big fan of sqlite. For a nice open source db gui
utility, download a copy of SQLite Database browser at
http://sqlitebrowser.sourceforge.net.

-- Paul
Aug 19 '06 #5
John Machin wrote:
Your confusion is quite understandable. I started looking at sqlite
when the announcement that it would be included in Python 2.5 came out.
Puzzlement reigned. I ended up with the following up the front of my
experimental module:
So does this mean that when 2.5 is released, all I need is the built-in
module sqlite3?
Aug 19 '06 #6

John Salerno wrote:
John Machin wrote:
Your confusion is quite understandable. I started looking at sqlite
when the announcement that it would be included in Python 2.5 came out.
Puzzlement reigned. I ended up with the following up the front of my
experimental module:

So does this mean that when 2.5 is released, all I need is the built-in
module sqlite3?
Plus the command-line utility, which AFAICT is not included with Python
2.5.

Aug 19 '06 #7
John Machin wrote:
John Salerno wrote:
>John Machin wrote:
>>Your confusion is quite understandable. I started looking at sqlite
when the announcement that it would be included in Python 2.5 came out.
Puzzlement reigned. I ended up with the following up the front of my
experimental module:
So does this mean that when 2.5 is released, all I need is the built-in
module sqlite3?

Plus the command-line utility, which AFAICT is not included with Python
2.5.
Why? The sqlite3 module links to the library; it doesn't need a separate
executable. Or is that what you meant (since one generally never installs the
library without also installing the executable, too)?

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Aug 19 '06 #8
Dennis Lee Bieber wrote:
SQLite, in whatever incarnation, is a "file server" database. There
is no separate database server running -- each application is linked
directly to the code that opens and processes the database file(s).

If SQLite is supplied with the impending Python 2.5, then the
code/library to access the database file is included. If one is running
Python 2.4, then one needs to obtain the third-party pysqlite package --
which, as I recall, includes the runtime library that does the database
file work.

The only reason, then, to download the stand-alone SQLite package
(not the python package) would be to obtain the command line query/admin
tool.
Thanks, that was a great response that pretty much covered everything I
was wondering. I would need pysqlite right now (2.4), or sqlite3 (2.5),
and I don't necessarily need the command line program if I'm using
Python as an interface.

What is really confusing is that I did a search for 'sqlite' in my
Ubuntu repositories and it came up with entries like this:

python2.4-pysqlite1.1 python interface to SQLite 3
python2.4-pysqlite2 python interface to SQLite 3
python2.4-pysqlite python interface to SQLite 2
python-pysqlite1.1 python interface to SQLite 3
python-pysqlite2 python interface to SQLite 3
python-sqlite python interface to SQlite 2

Needless to say, the numbering had me banging my head against my desk.
Aug 19 '06 #9

Robert Kern wrote:
John Machin wrote:
John Salerno wrote:
John Machin wrote:

Your confusion is quite understandable. I started looking at sqlite
when the announcement that it would be included in Python 2.5 came out.
Puzzlement reigned. I ended up with the following up the front of my
experimental module:
So does this mean that when 2.5 is released, all I need is the built-in
module sqlite3?
Plus the command-line utility, which AFAICT is not included with Python
2.5.

Why? The sqlite3 module links to the library; it doesn't need a separate
executable. Or is that what you meant (since one generally never installs the
library without also installing the executable, too)?
Hi, Robert,

Sorry if that and the earlier message were unclear. The Python module
does Python DPAPI without any help from the standalone executable.
AFAICT (so far) the standalone executable also links to the library; it
provides a command-line interface to most/all the underlying sqlite
functionality. This is my understanding, but as stated earlier, I
haven't been playing with it for long, and maybe the Python module goes
way beyond DBAPI and I haven't stumbled on the extra goodies yet.

Regards,
John

Aug 19 '06 #10

Dennis Lee Bieber wrote:
>
The only reason, then, to download the stand-alone SQLite package
(not the python package) would be to obtain the command line query/admin
tool.
Pre-compiles binaries of the tool are available for Linux and Windows.
http://www.sqlite.org/download.html

Cheers,
John

Aug 19 '06 #11
John Salerno <jo******@NOSPAMgmail.comwrites:
What is really confusing is that I did a search for 'sqlite' in my
Ubuntu repositories and it came up with entries like this:

python2.4-pysqlite1.1 python interface to SQLite 3
python2.4-pysqlite2 python interface to SQLite 3
python2.4-pysqlite python interface to SQLite 2
That's python2.4-sqlite, not python2.4-pysqlite. The reason for both
having pythonX.Y-foo and python-foo packages is Debian's (and
therefore Ubuntu's) Python package policy.
python-pysqlite1.1 python interface to SQLite 3
python-pysqlite2 python interface to SQLite 3
python-sqlite python interface to SQlite 2

Needless to say, the numbering had me banging my head against my
desk.
Sorry to hear that, and I can understand that the names are a bit
confusing.

Here's the story behind the mess:

In the beginning (well, at least in 2003 when I found out about
SQLite), SQLite was up to version 2.something and the Python module
was called sqlite.py. While the Python module *project* was called
pysqlite 0.something, Debian modules were generally called python-foo
when providing the module foo; hence the name python-sqlite.

Then, SQLite 3 was released (incompatible with SQLite 2 databases),
and pysqlite 1.1 was released with the same module name (sqlite.py)
and API as the old sqlite.py module but linked against SQLite 3. I
decided not to package that version but instead wait for pysqlite 2, a
rewritten and improved version linked against SQLite 3 and with a new
Python API.

pysqlite 2 was released and the Python module was called
pysqlite2.dbapi2. I didn't think python-sqlite3 would be a good name
for the Debian package since there were actually two different
pysqlite versions (both actively maintained) linked against SQLite3,
so I ended up calling the package python-pysqlite2, following the name
and version of the pysqlite project instead of the module.

Finally, by request of Debian users, I also packaged the other
pysqlite version linked against SQLite 3 giving the package
python-pysqlite1.1.

Oh, and then there's python-apsw too. :-)

Regards,
Joel (maintainer of Debian's Python-related sqlite packages)

--
Joel Rosdahl <jo**@rosdahl.net>
Key BB845E97; fingerprint 9F4B D780 6EF4 5700 778D 8B22 0064 F9FF BB84 5E97
Aug 19 '06 #12
Joel Rosdahl wrote:
John Salerno <jo******@NOSPAMgmail.comwrites:
>What is really confusing is that I did a search for 'sqlite' in my
Ubuntu repositories and it came up with entries like this:

python2.4-pysqlite1.1 python interface to SQLite 3
python2.4-pysqlite2 python interface to SQLite 3
python2.4-pysqlite python interface to SQLite 2

That's python2.4-sqlite, not python2.4-pysqlite. The reason for both
having pythonX.Y-foo and python-foo packages is Debian's (and
therefore Ubuntu's) Python package policy.
>python-pysqlite1.1 python interface to SQLite 3
python-pysqlite2 python interface to SQLite 3
python-sqlite python interface to SQlite 2

Needless to say, the numbering had me banging my head against my
desk.

Sorry to hear that, and I can understand that the names are a bit
confusing.

Here's the story behind the mess:

In the beginning (well, at least in 2003 when I found out about
SQLite), SQLite was up to version 2.something and the Python module
was called sqlite.py. While the Python module *project* was called
pysqlite 0.something, Debian modules were generally called python-foo
when providing the module foo; hence the name python-sqlite.

Then, SQLite 3 was released (incompatible with SQLite 2 databases),
and pysqlite 1.1 was released with the same module name (sqlite.py)
and API as the old sqlite.py module but linked against SQLite 3. I
decided not to package that version but instead wait for pysqlite 2, a
rewritten and improved version linked against SQLite 3 and with a new
Python API.

pysqlite 2 was released and the Python module was called
pysqlite2.dbapi2. I didn't think python-sqlite3 would be a good name
for the Debian package since there were actually two different
pysqlite versions (both actively maintained) linked against SQLite3,
so I ended up calling the package python-pysqlite2, following the name
and version of the pysqlite project instead of the module.

Finally, by request of Debian users, I also packaged the other
pysqlite version linked against SQLite 3 giving the package
python-pysqlite1.1.

Oh, and then there's python-apsw too. :-)

Regards,
Joel (maintainer of Debian's Python-related sqlite packages)
Yikes! Well at least it gets simpler when 2.5 is released with the
module built-in! :)
Aug 19 '06 #13

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

Similar topics

1
by: David Fowler | last post by:
I'm new to getting in touch with other PHP users/PHP team, so please excuse me if this post is at all inappropriate or in the wrong place. In the current release of PHP (5.1.4) and in the CVS for...
4
by: Jim Carlock | last post by:
I added the following lines to PHP.INI. extension=php_pdo.dll extension=php_pdo_sqlite.dll extension=php_sqlite.dll specifically in that order. I noticed the extensions getting loaded are...
3
by: Brian Blais | last post by:
Hello, I have more of a conceptual question about the way databases work, in a web framework, but I will be implementing things with CherryPy and SQLAlchemy. If you make a web form that adds...
14
by: 7stud | last post by:
Does sqlite come in a mac version? Thanks.
10
by: Luigi | last post by:
Hello all! I'm a newbie in PHP. I have written a short script that tries to update a SQLite database with the user data. It is pretty simple, something like this: <?php $sqlite =...
9
by: Gilles Ganault | last post by:
Hello I was looking for a lighter web server than Apache, and installed Lighttpd on CentOS through yum. It works fine, but I now need to use SQLite from a PHP script. I seem to understand that...
8
by: Gilles Ganault | last post by:
Hello I need to compile PHP5 with SQLite statically and without PDO. I don't need DB-independence, so it's fine using sqlite_*() functions instead of PDO. 1. I've downloaded, compiled, and...
3
by: Daniel Fetchinson | last post by:
Does Python 2.5.2's embedded SQLite support full text searching? Sqlite itself is not distributed with python. Only a python db api compliant wrapper is part of the python stdlib and as such it...
20
by: timotoole | last post by:
Hi all, On a (sun) webserver that I use, there is python 2.5.1 installed. I'd like to use sqlite3 with this, however sqlite3 is not installed on the webserver. If I were able to compile sqlite...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.