Dennis Lee Bieber wrote:
Does Python 3.x include SQLite?
Of course ;-]
>>> import sqlite3
>>> dir(sqlite3)
['Binary', 'Cache', 'Connection', 'Cursor', 'DataError',
[snip]
adapt', 'adapters', 'apilevel', 'complete_statement', 'connect',
'converters', 'datetime', 'dbapi2', 'enable_callback_tr
Anjanesh Lekshminarayanan wrote:
>> Maybe it would help if you explained what you are actually trying to
>> accomplish.
>
> import csv
> f = csv.reader(open('data.txt'), delimiter='\t') # 2GB text file
> sql = "INSERT INTO `data` VALUES (NULL,%s,%s,%s,%s,%s);"
> for row in f:
> print (sql, (r
> Maybe it would help if you explained what you are actually trying to
> accomplish.
import csv
f = csv.reader(open('data.txt'), delimiter='\t') # 2GB text file
sql = "INSERT INTO `data` VALUES (NULL,%s,%s,%s,%s,%s);"
for row in f:
print (sql, (row[0],row[1],row[2],row[3],row[4]))
$ python3 p
Anjanesh Lekshminarayanan wrote:
> As of now, there is no mysql adaptor for Python3. Hence cant use
> escape_string()
Maybe it would help if you explained what you are actually trying to
accomplish.
--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/p
As of now, there is no mysql adaptor for Python3. Hence cant use escape_string()
> I don't have the slightest clue what you want to say with that.
--
Anjanesh Lekshmnarayanan
--
http://mail.python.org/mailman/listinfo/python-list
Anjanesh Lekshminarayanan wrote:
>> Depending on your DB-adapter, you are out of luck here. Either connect to
>> a db even if you don't need it, or try & see if you can locate the
>> implementation in the module somehow.
>
> ImportError: No module named MySQLdb
> MySQLdb only available in Python2
> Depending on your DB-adapter, you are out of luck here. Either connect to a
> db even if you don't need it, or try & see if you can locate the
> implementation in the module somehow.
ImportError: No module named MySQLdb
MySQLdb only available in Python2.
--
Anjanesh Lekshmnarayanan
--
http:
Anjanesh Lekshminarayanan wrote:
> Python 3.1.1
>
> sql = "INSERT INTO `tbl` VALUES (NULL, '%s', '%s', '%s', '%s', '%s');"
> for row in fp:
> print (sql, (row[0],row[1],row[2],row[3],row[4]))
> .
> INSERT INTO `tbl` VALUES (NULL, '%s', '%s', '%s', '%s', '%s'); ('142',
> 'abc', '2006-04-09 02:
Python 3.1.1
sql = "INSERT INTO `tbl` VALUES (NULL, '%s', '%s', '%s', '%s', '%s');"
for row in fp:
print (sql, (row[0],row[1],row[2],row[3],row[4]))
.
INSERT INTO `tbl` VALUES (NULL, '%s', '%s', '%s', '%s', '%s'); ('142',
'abc', '2006-04-09 02:19:24', '', '')
.
Why is it showing %s in the outp