Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-90016: Reword sqlite3 adapter/converter docs#93095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes from1 commit
Commits
Show all changes
34 commits
Select commitHold shift + click to select a range
598e26a
gh-90016: Reword sqlite3 adapter/converter docs
erlend-aaslandMay 23, 2022
e5b1b88
Add current adapters/converter as recipes: improve this
erlend-aaslandMay 23, 2022
9399b54
default role
erlend-aaslandMay 23, 2022
40bb59a
Formatting
erlend-aaslandMay 23, 2022
82cf3e2
Address Serhiy's review
erlend-aaslandMay 23, 2022
0b6f381
Address Alex' review
erlend-aaslandMay 25, 2022
c4dde48
Nit
erlend-aaslandMay 25, 2022
72013ef
Address Alex' nitpicks
erlend-aaslandMay 25, 2022
3c70d52
Address in-house review
erlend-aaslandMay 25, 2022
681baad
Recipes, take 1
erlend-aaslandMay 25, 2022
bf4cb1f
Docstring wording
erlend-aaslandMay 25, 2022
2d1a0c1
Update Doc/library/sqlite3.rst
Jun 22, 2022
94308ff
Update Doc/library/sqlite3.rst
Jun 22, 2022
06657f2
Update Doc/library/sqlite3.rst
Jun 22, 2022
b98e363
Update Doc/library/sqlite3.rst
Jun 22, 2022
97812bb
Update Doc/library/sqlite3.rst
Jun 22, 2022
d3dd5a2
Update Doc/library/sqlite3.rst
Jun 22, 2022
f381b65
Update Doc/library/sqlite3.rst
Jun 22, 2022
65eb45c
Update Doc/library/sqlite3.rst
Jun 22, 2022
172c7d9
Update Doc/library/sqlite3.rst
Jun 22, 2022
5ac2af9
Update Doc/library/sqlite3.rst
Jun 22, 2022
433bf5a
Update Doc/library/sqlite3.rst
Jun 22, 2022
f7646de
Update Doc/library/sqlite3.rst
Jun 22, 2022
6fbcff8
Assuming direct control
Jun 22, 2022
b319b54
Address the last part of CAM's review
erlend-aaslandJun 23, 2022
4e3b8fd
Merge branch 'main' into sqlite-doc-converters
erlend-aaslandJun 23, 2022
e821a7e
Clarify parse column names further
erlend-aaslandJun 23, 2022
bc295d8
Revert unneeded change
erlend-aaslandJun 23, 2022
9235f8d
Further clarify register_converter
erlend-aaslandJun 23, 2022
8484164
Use testsetup/doctest
erlend-aaslandJun 23, 2022
b579f67
Revert "Use testsetup/doctest"
erlend-aaslandJun 23, 2022
0e42fa6
Update Doc/library/sqlite3.rst
Jun 24, 2022
8d97fcb
Reflow
erlend-aaslandJun 25, 2022
d300b33
Merge remote-tracking branch 'upstream/main' into sqlite-doc-converters
erlend-aaslandJun 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Reflow
  • Loading branch information
@erlend-aasland
erlend-aasland committedJun 25, 2022
commit8d97fcb8e2f1c537d7a09bc9ca0e64fe0ba0bf8b
25 changes: 14 additions & 11 deletionsDoc/library/sqlite3.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -334,9 +334,9 @@ Module functions and constants

.. function:: register_converter(typename, converter)

Register the *converter* 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*;
Register the *converter* callable to convert SQLite objects of type
*typename* into aPython 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
Expand All@@ -348,9 +348,10 @@ Module functions and constants

.. function:: register_adapter(type, adapter)

Register an *adapter* 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
Register an *adapter* 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>`.


Expand DownExpand Up@@ -1273,10 +1274,11 @@ To store custom Python types in SQLite databases, *adapt* them to one of the

There are two ways to adapt Python objects to SQLite types:
letting your object adapt itself, or using an *adapter callable*.
The latter will take precedence above the former. For a library that exports a
custom type, it may make sense to enable that type to adapt itself. As an
application developer, it may make more sense to take direct control by registering
custom adapter functions.
The latter will take precedence above the former.
For a library that exports a custom type,
it may make sense to enable that type to adapt itself.
As an application developer, it may make more sense to take direct control by
registering custom adapter functions.


Letting your object adapt itself
Expand DownExpand Up@@ -1306,7 +1308,8 @@ This function can then be registered using :func:`register_adapter`.
Converting SQLite values to custom Python types
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Writing an adapter lets you convert *from* custom Python types *to* SQLite values.
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*.

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp