By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,235 Members | 1,011 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,235 IT Pros & Developers. It's quick & easy.

Sqlite syntax

P: n/a
Is there some documentation out there that actually lists the Sqlite
syntax?
Or even better, one that crosses over and talks about how it works with
python?

Sqlite seems quite the nifty little thing, but for some reason, I can't
seem to get a list of tables in my databases through a python prompt.

Help?

And since the databases aren't 'centralized' there's no way of knowing
what databases I have floating around is there?

Stryder
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
At some point, "firephreek" <fi********@earthlink.net> wrote:
Is there some documentation out there that actually lists the Sqlite
syntax?
You mean the SQL dialect it speaks? http://sqlite.org/lang.html
Or even better, one that crosses over and talks about how it works with
python?
Like all the other DB interfaces. See the pysqlite homepage for specifics.
Sqlite seems quite the nifty little thing, but for some reason, I can't
seem to get a list of tables in my databases through a python
prompt.
From http://sqlite.org/lang.html#createtable, all the tables are
listed in the sqlite_master table, so
import sqlite
cx = sqlite.connect("db")
cu = cx.cursor()
cu.execute('''SELECT * FROM sqlite_master''')

[('table', 'TEST', 'TEST', 3, 'CREATE TABLE TEST (V VARCHAR, I INTEGER)')]
And since the databases aren't 'centralized' there's no way of knowing
what databases I have floating around is there?


Use 'ls' :-). Each database is a separate file.

--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
Jul 18 '05 #2

P: n/a

"firephreek" <fi********@earthlink.net> wrote in message
news:ma************************************@python .org...
Is there some documentation out there that actually lists the Sqlite
syntax?
http://sqlite.org/lang.html
Or even better, one that crosses over and talks about how it works with
python?
That be mainly here: http://www.python.org/topics/database/ under
http://www.python.org/peps/pep-0249.html
And since the databases aren't 'centralized' there's no way of knowing
what databases I have floating around is there?


It is "lite" - which means that you have to remember where you put stuff ;-)
A ConfigParser object is a good place to keep track of that sort of thing.
Jul 18 '05 #3

P: n/a
On 2004-05-28, Frithiof Andreas Jensen <frithiof.jensen@die_spammer_die.ericsson.com> wrote:

"firephreek" <fi********@earthlink.net> wrote in message
news:ma************************************@python .org...
Is there some documentation out there that actually lists the Sqlite
syntax?


http://sqlite.org/lang.html
Or even better, one that crosses over and talks about how it works with
python?


That be mainly here: http://www.python.org/topics/database/ under
http://www.python.org/peps/pep-0249.html


See also http://pysqlite.sf.net
Their website in a bit on the brief side as the documentation is being
updated, but check out the mailing list for examples on how to use it.
It is a most convenient and powerful interface with intuitive commands.
You ought to check it out!
And since the databases aren't 'centralized' there's no way of knowing
what databases I have floating around is there?


It is "lite" - which means that you have to remember where you put stuff ;-)
A ConfigParser object is a good place to keep track of that sort of thing.

Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.