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

Appearance settings

bpo-24905: Support BLOB incremental I/O in sqlite module #271

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Fix CR comments in documentation and testing
  • Loading branch information
palaviv committed Aug 3, 2020
commit 354bebf2dc561a6f079fc430edf8d9eb7cab6496
6 changes: 3 additions & 3 deletions 6 Doc/includes/sqlite3/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
con.execute("insert into test(blob_col) values (zeroblob(10))")
# opening blob handle
blob = con.open_blob("test", "blob_col", 1, 1)
palaviv marked this conversation as resolved.
Show resolved Hide resolved
blob.write(b"a" * 5)
blob.write(b"b" * 5)
blob.write(b"Hello")
blob.write(b"World")
blob.seek(0)
print(blob.read()) # will print b"aaaaabbbbb"
print(blob.read()) # will print b"HelloWorld"
blob.close()
6 changes: 3 additions & 3 deletions 6 Doc/includes/sqlite3/blob_with.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
con.execute("insert into test(blob_col) values (zeroblob(10))")
# opening blob handle
with con.open_blob("test", "blob_col", 1, 1) as blob:
blob.write(b"a" * 5)
blob.write(b"b" * 5)
blob.write(b"Hello")
blob.write(b"World")
blob.seek(0)
print(blob.read()) # will print b"aaaaabbbbb"
print(blob.read()) # will print b"HelloWorld"
5 changes: 3 additions & 2 deletions 5 Doc/library/sqlite3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,9 @@ Blob Objects

A :class:`Blob` instance can read and write the data in the
:abbr:`BLOB (Binary Large OBject)`. The :class:`Blob` object implement both
the file and sequence protocol. For example You can read data from the
the file and sequence protocol. For example, you can read data from the
:class:`Blob` by doing ``obj.read(5)`` or by doing ``obj[:5]``.
You can call ``len(obj)`` to get size of the BLOB.

.. method:: Blob.close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Blob.* prefix can be removed.


Expand Down Expand Up @@ -911,7 +912,7 @@ Blob Objects

Return the current offset of the BLOB.

.. method:: Blob.seek(offset, [whence])
.. method:: Blob.seek(offset, whence=os.SEEK_SET)

Set the BLOB offset. The *whence* argument is optional and defaults to
:data:`os.SEEK_SET` or 0 (absolute BLOB positioning); other values
Expand Down
8 changes: 5 additions & 3 deletions 8 Lib/sqlite3/test/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,9 +1177,11 @@ def suite():
blob_suite = unittest.makeSuite(BlobTests, "Check")
closed_blob_suite = unittest.makeSuite(ClosedBlobTests, "Check")
blob_context_manager_suite = unittest.makeSuite(BlobContextManagerTests, "Check")
return unittest.TestSuite((module_suite, connection_suite, cursor_suite, thread_suite, constructor_suite,
ext_suite, closed_con_suite, closed_cur_suite, on_conflict_suite,
blob_suite, closed_blob_suite, blob_context_manager_suite))
return unittest.TestSuite((
module_suite, connection_suite, cursor_suite, thread_suite, constructor_suite,
ext_suite, closed_con_suite, closed_cur_suite, on_conflict_suite,
blob_suite, closed_blob_suite, blob_context_manager_suite,
))

def test():
runner = unittest.TextTestRunner()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The :class:`sqlite3.Connection` now has the
:meth:`sqlite3.Connection.open_blob` method. The :class:`sqlite3.Blob`
allows incremental I/O operations to blobs. (Contributed by Aviv Palivoda in
allows incremental I/O operations to blobs. (Patch by Aviv Palivoda in
:issue:`24905`)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.