• Home
  • Raw
  • Download

Lines Matching refs:sqlite3

1 :mod:`sqlite3` --- DB-API 2.0 interface for SQLite databases
4 .. module:: sqlite3
9 **Source code:** :source:`Lib/sqlite3/`
20 The sqlite3 module was written by Gerhard Häring. It provides an SQL interface
28 import sqlite3
29 con = sqlite3.connect('example.db')
56 import sqlite3
57 con = sqlite3.connect('example.db')
100 .. literalinclude:: ../includes/sqlite3/execute_1.py
130 the :mod:`sqlite3` module. Required by the DB-API. Hard-coded to
135 The :mod:`sqlite3` module supports both ``qmark`` and ``numeric`` DB-API
165 the :mod:`sqlite3` module supports. Currently hard-coded to ``1``, meaning
170 import sqlite3
171 con = sqlite3.connect(":memory:")
187 Setting it makes the :mod:`sqlite3` module parse the declared type for each
246 By default, the :mod:`sqlite3` module uses its :class:`Connection` class for the
251 Consult the section :ref:`sqlite3-types` of this manual for details.
253 The :mod:`sqlite3` module internally uses a statement cache to avoid SQL parsing
265 con = sqlite3.connect("file:template.db?mode=ro", uri=True)
268 # Will raise sqlite3.OperationalError if unable to open a database file.
269 con = sqlite3.connect("file:nosuchdb.db?mode=rw", uri=True)
272 con1 = sqlite3.connect("file:mem1?mode=memory&cache=shared", uri=True)
273 con2 = sqlite3.connect("file:mem1?mode=memory&cache=shared", uri=True)
281 .. audit-event:: sqlite3.connect database sqlite3.connect
282 .. audit-event:: sqlite3.connect/handle connection_handle sqlite3.connect
291 Added the ``sqlite3.connect/handle`` auditing event.
321 .. literalinclude:: ../includes/sqlite3/complete_statement.py
346 :ref:`sqlite3-controlling-transactions` for a more detailed explanation.
420 .. literalinclude:: ../includes/sqlite3/md5func.py
437 .. literalinclude:: ../includes/sqlite3/mysumaggr.py
453 .. literalinclude:: ../includes/sqlite3/collation_reverse.py
474 :mod:`sqlite3` module.
485 one. All necessary constants are available in the :mod:`sqlite3` module.
512 :ref:`transaction management <sqlite3-controlling-transactions>` of the
513 sqlite3 module and the execution of triggers defined in the current
521 :meth:`~sqlite3.enable_callback_tracebacks` to enable printing
536 … .. audit-event:: sqlite3.enable_load_extension connection,enabled sqlite3.enable_load_extension
541 Added the ``sqlite3.enable_load_extension`` auditing event.
543 .. literalinclude:: ../includes/sqlite3/load_extension.py
553 .. audit-event:: sqlite3.load_extension connection,path sqlite3.load_extension
558 Added the ``sqlite3.load_extension`` auditing event.
569 .. literalinclude:: ../includes/sqlite3/row_factory.py
573 highly-optimized :class:`sqlite3.Row` type. :class:`Row` provides both
585 :mod:`sqlite3` module will return :class:`str` objects for ``TEXT``.
593 .. literalinclude:: ../includes/sqlite3/text_factory.py
606 the same capabilities as the :kbd:`.dump` command in the :program:`sqlite3`
612 import sqlite3
614 con = sqlite3.connect('existing_db.db')
649 import sqlite3
654 con = sqlite3.connect('existing_db.db')
655 bck = sqlite3.connect('backup.db')
663 import sqlite3
665 source = sqlite3.connect('existing_db.db')
666 dest = sqlite3.connect(':memory:')
687 :ref:`placeholders <sqlite3-placeholders>`.
697 Executes a :ref:`parameterized <sqlite3-placeholders>` SQL command
699 *seq_of_parameters*. The :mod:`sqlite3` module also allows using an
702 .. literalinclude:: ../includes/sqlite3/executemany_1.py
706 .. literalinclude:: ../includes/sqlite3/executemany_2.py
720 .. literalinclude:: ../includes/sqlite3/executescript.py
760 Required by the DB-API. Does nothing in :mod:`sqlite3`.
764 Required by the DB-API. Does nothing in :mod:`sqlite3`.
768 Although the :class:`Cursor` class of the :mod:`sqlite3` module implements this
816 >>> con = sqlite3.connect(":memory:")
848 con = sqlite3.connect(":memory:")
860 >>> con.row_factory = sqlite3.Row
863 <sqlite3.Cursor object at 0x7f4e7dd8fa80>
866 <class 'sqlite3.Row'>
977 The type system of the :mod:`sqlite3` module is extensible in two ways: you can
979 you can let the :mod:`sqlite3` module convert SQLite types to different Python
988 sqlite3 module's supported types for SQLite: one of NoneType, int, float,
991 There are two ways to enable the :mod:`sqlite3` module to adapt a custom Python
1011 .. literalinclude:: ../includes/sqlite3/adapter_point_1.py
1020 .. literalinclude:: ../includes/sqlite3/adapter_point_2.py
1022 The :mod:`sqlite3` module has two default adapters for Python's built-in
1027 .. literalinclude:: ../includes/sqlite3/adapter_datetime.py
1055 Now you need to make the :mod:`sqlite3` module know that what you select from
1062 Both ways are described in section :ref:`sqlite3-module-contents`, in the entries
1067 .. literalinclude:: ../includes/sqlite3/converter_point.py
1086 .. literalinclude:: ../includes/sqlite3/pysqlite_datetime.py
1104 The underlying ``sqlite3`` library operates in ``autocommit`` mode by default,
1105 but the Python :mod:`sqlite3` module by default does not.
1112 The Python :mod:`sqlite3` module by default issues a ``BEGIN`` statement
1116 You can control which kind of ``BEGIN`` statements :mod:`sqlite3` implicitly
1123 You can disable the :mod:`sqlite3` module's implicit transaction management by
1125 ``sqlite3`` library operating in ``autocommit`` mode. You can then completely
1133 :mod:`sqlite3` used to implicitly commit an open transaction before DDL
1137 Using :mod:`sqlite3` efficiently
1152 .. literalinclude:: ../includes/sqlite3/shortcut_methods.py
1158 One useful feature of the :mod:`sqlite3` module is the built-in
1159 :class:`sqlite3.Row` class designed to be used as a row factory.
1164 .. literalinclude:: ../includes/sqlite3/rowclass.py
1175 .. literalinclude:: ../includes/sqlite3/ctx_manager.py
1180 .. [#f1] The sqlite3 module is not built with loadable extension support by