[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] sqlite-amalgamation



On Thu, Apr 3, 2008 at 9:19 AM, Amit Uttamchandani <atu13439@csun.edu> wrote:
> Hey everyone,
>
>  I am currently evaluating the use of sqlite3 to store application data from a python application that I am writing.
>
>  I am using Debian Etch so some of the packages are out of date and thus I decided to compile them from source. Python 2.5.2 was fairly straightforward to compile and install.

>From python >2.5 you don't need anything. sqlite is included by
default (note: that has nothing to do with the userspace tools to
access a databasee from the commandline)

~ $ python
Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3 as sqlite
>>> con = sqlite.connect(':memory:')
>>> c = con.cursor()
>>> c.execute("""CREATE TABLE test(id INTEGER, message TEXT);""")
<sqlite3.Cursor object at 0xb7d81f20>
>>> c.execute("INSERT INTO test (id, message) VALUES (?, ?)", (1, "message 1"))
<sqlite3.Cursor object at 0xb7d81f20>
>>> c.execute("INSERT INTO test (id, message) VALUES (?, ?)", (1, "message 2"))
<sqlite3.Cursor object at 0xb7d81f20>
>>> c.execute("INSERT INTO test (id, message) VALUES (?, ?)", (1, "message 3"))
<sqlite3.Cursor object at 0xb7d81f20>
>>> result = c.execute("SELECT id, message FROM test")
>>> for row in result:
...     print row
...
(1, u'message 1')
(1, u'message 2')
(1, u'message 3')
>>> exit()



-- 
http://tumblr.marcher.name
https://twitter.com/MartinMarcher
http://www.xing.com/profile/Martin_Marcher
http://www.linkedin.com/in/martinmarcher

You are not free to read this message,
by doing so, you have violated my licence
and are required to urinate publicly. Thank you.


Reply to: