SQLITE3
SQLITE3
sqlite3.version
The version number of this module, as a string. This is not the
version of the SQLite library.
sqlite3.version_info
The version number of this module, as a tuple of integers. This is
not the version of the SQLite library.
sqlite3.sqlite_version
sqlite3.sqlite_version_info
The version number of the run-time SQLite library, as a tuple of
integers.
sqlite3.PARSE_DECLTYPES
This constant is meant to be used with the detect_types parameter
of the connect() function.
Setting it makes the sqlite3 module parse the declared type for
each column it returns. It will parse out the first word of the
declared type, i. e. for “integer primary key”, it will parse out
“integer”, or for “number(10)” it will parse out “number”. Then for
that column, it will look into the converters dictionary and use the
converter function registered for that type there.
sqlite3.PARSE_COLNAMES
Setting this makes the SQLite interface parse the column name for
each column it returns. It will look for a string formed [mytype] in
there, and then decide that ‘mytype’ is the type of the column. It
will try to find an entry of ‘mytype’ in the converters dictionary
and then use the converter function found there to return the value.
The column name found in Cursor.description does not include the
type,i.e.ifyouuse something like 'as "Expiration date [datetime]"' in
your SQL, then we will parse out everything until the first '[' for
the column name and strip the preceeding space: the column name
would simply be “Expiration date”.
sqlite3.register_converter(typename, callable)
Registers a callable to convert a bytestring from the database into a
custom Python type. The callable will be invoked for all database
values that are of the type typename. Confer the
parameter detect_types of the connect() function for how the type
detection works. Note that typename and the name of the type in
your query are matched in case-insensitive manner.
sqlite3.register_adapter(type, callable)
Registers a callable to convert the custom Python type type into
one of SQLite’s supported types. The callable callable accepts as
single parameter the Python value, and must return a value of the
following types: int, float, str or bytes.
sqlite3.complete_statement(sql)
Returns True if the string sql contains one or more complete SQL
statements terminated by semicolons. It does not verify that the
SQL is syntactically correct, only that there are no unclosed string
literals and the statement is terminated by a semicolon.