[pysqlite] (no subject)

Waseem Bourgi <alwaseem307ster-/[email protected]> Fri, 28 Nov 2008 20:20:58 -0800 (PST)
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
			
			hey

i am facing this problem in my following codes where i am trying to
create a database using pysqlite and load data from text file where
data is arranged in this form "Birthday2|12/5/2008|HTC|this is my
birthday"

but i could connect to the database, create it into my current working
directory but i can't load the data from my text file in same working
directory, i don't know the exact syntax for doing that.
 

Also can someone help to rename the file name of the database to current date and time rather than user specified name in which every time the database will be created in current date and time.
 

Thanks in advance
 
    Expand|Select|Wrap|Line Numbers   #Connecting to Database
import os
import sqlite3
from pysqlite2 import dbapi2 as sqlite
connection = sqlite.connect('Photos.db')
memoryConnection = sqlite.connect(':memory:')
cursor = connection.cursor() 
#Writing  Data to Database
#Getting data from Text File 
TXT_FILE = os.getcwd() + "\\Photos.txt"
cursor.execute('CREATE TABLE photos (Name VARCHAR(100) PRIMARY KEY, Date INTEGER, Make VARCHAR(50), Tag VARCHAR(100))') 
cursor.execute('SEPARATOR "|"')
cursor.execute('IMPORT Photos.txt Photos')
connection.commit()

_______________________________________________
list-pysqlite mailing list
list-pysqlite-FR6EJeJVuqdwc357pe9rcyQmJico6nz3epZhswDD4dQ@public.gmane.org
http://itsystementwicklung.de/cgi-bin/mailman/listinfo/list-pysqlite