In article <mailman.2017.1265411978.28905.python-l...@python.org>, Steve Holden <st...@holdenweb.com> wrote: > >No. That's not how you pass commands to sqlite3 - you connect to a >database, create a cursor on the connection, and then execute SQL >statements (not sqlite commands) on the cursor. Like this: > >>>> import sqlite3 >>>> c = sqlite3.connect("deleteme") >>>> cu = c.cursor() >>>> cu.execute(".help") >Traceback (most recent call last): > File "<stdin>", line 1, in <module> >sqlite3.OperationalError: near ".": syntax error >>>> cu.execute("""\ >... CREATE TABLE test( >... a int primary key, >... b varchar)""") ><sqlite3.Cursor object at 0x01FD4740> >>>> > >As you can see, the cursor's execute() method expects SQL statements.
However, it may not be obvious that some things that don't look like SQL are. For example, "pragma integrity_check". -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "At Resolver we've found it useful to short-circuit any doubt and just refer to comments in code as 'lies'. :-)" -- http://mail.python.org/mailman/listinfo/python-list