Teks sumber — English
Terjemahan — Bahasa Indonesia
Control whether and how data types not :ref:`natively supported by SQLite <sqlite3-types>` are looked up to be converted to Python types, using the converters registered with :func:`register_converter`. Set it to any combination (using ``|``, bitwise or) of :const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES` to enable this. Column names take precedence over declared types if both flags are set. By default (``0``), type detection is disabled.
Register an *adapter* :term:`callable` to adapt the Python type *type* into an SQLite type. The adapter is called with a Python object of type *type* as its sole argument, and must return a value of a :ref:`type that SQLite natively understands <sqlite3-types>`.
Register the *converter* :term:`callable` to convert SQLite objects of type *typename* into a Python object of a specific type. The converter is invoked for all SQLite values of type *typename*; it is passed a :class:`bytes` object and should return an object of the desired Python type. Consult the parameter *detect_types* of :func:`connect` for information regarding how type detection works.
SQLite and Python types
SQLite dan tipe Python
The following Python types can thus be sent to SQLite without any problem:
Python type
tipe Python
This is how SQLite types are converted to Python types by default:
The type system of the :mod:`!sqlite3` module is extensible in two ways: you can store additional Python types in an SQLite database via :ref:`object adapters <sqlite3-adapters>`, and you can let the :mod:`!sqlite3` module convert SQLite types to Python types via :ref:`converters <sqlite3-converters>`.
How to adapt custom Python types to SQLite values
SQLite supports only a limited set of data types natively. To store custom Python types in SQLite databases, *adapt* them to one of the :ref:`Python types SQLite natively understands <sqlite3-types>`.
How to convert SQLite values to custom Python types
Writing an adapter lets you convert *from* custom Python types *to* SQLite values. To be able to convert *from* SQLite values *to* custom Python types, we use *converters*.