-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-69093: Support basic incremental I/O to blobs in sqlite3
#30680
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
Merged
JelleZijlstra
merged 110 commits into
python:main
from
erlend-aasland:sqlite-blob-reduced
Apr 15, 2022
Merged
Changes from all commits
Commits
Show all changes
110 commits
Select commit
Hold shift + click to select a range
4fa0e91
support BLOB incremental I/O in sqlite module
palaviv 3fe9108
Note that blob size cannot be changed using the blob object
palaviv 865c1c8
Use assertRaises in tests
palaviv 788fd54
Fix doc error
palaviv a1361e5
blob support sequence protocol
palaviv 5aedfba
Calculate blob length once at creation
palaviv db6ef32
Add initial Doc for sequence protocol
palaviv 219f4cb
Don't support blob operation
palaviv 6dafe0e
move news entry to blurb
palaviv ffac901
Add blob to PCBuild
palaviv 3475fa1
Update version
palaviv f6015ff
Fix memory leak
palaviv 01e526c
Update version
palaviv 354bebf
Fix CR comments in documentation and testing
palaviv 9709456
Fix CR comments in code
palaviv e6e5099
Make readonly and dbname keyword arguements only
palaviv e9a8080
Fix more CR comments
palaviv d4fb1b5
Add more indicative error on write bigger then blob length
palaviv a7288f9
Merge branch 'main' into sqlite-blob
525a9c3
Adapt sqlite3.Connection.open_blob() to AC
2f65cc8
Adapt sqlite.Blob to AC
0dd047f
PEP 7 and normalised naming
d34a77b
Use Py_NewRef and Py_IsNone
9d55705
Harden blob_open()
d47ea17
Move blob init to blob_open()
e07a116
initialise rc in blob_ass_subscript()
982c812
Improve blob.seek() parameter naming
e92495b
Adapt to heap types and allow calling close multiple times
8f2ce8a
Consolidate tests
0a87520
Naming: read_length => length
32132cf
Wrap error handling in support function
287803e
Add blob seek position markers as constants
0fc5a39
Adjust SQLITE_ABORT error message
cd0bde1
Remove unneeded sqlite3_blob_close() and fix GC tracking
cf7e15e
Use close_blob() in pysqlite_close_all_blobs()
7e77217
Refactor write/read
c57e45a
Sipmlify __exit__
dd76f72
Use new slice API
237684e
Refactor very large functions
58905e8
Simplify subscript slice
9d69fca
Consolidate more tests
285bb3d
Use supplied offset in inner_read()
2f3051a
Simplify test
fd7c311
Simplify assign subscript slice
0644e87
Early error checking, and use PyBytes_AS_STRING() when possible
ced431a
Expand test suite
2dae1b9
Remove unneeded parts of sequence protocol
e8fa47e
Normalise error messages
6441668
Improve error message/type for to large subscript assignment
03d2152
Normalise naming: write_inner => inner_write
9360e62
Adjust comment
8eb16f7
Move blob_seterror() closer to where it's first used
411d07e
Fetch state from connection in check_blob()
8149e36
Remove unused declaration
56b4caa
Doc adjustments
afdeb2e
Add What's New and adjust NEWS
b12219f
Use sqlite3_blob_bytes() iso. storing length on blob object
32a21d8
Merge branch 'main' into sqlite-blob
36b0ca1
Also remove length from blob_open()
3d91705
Add get subscript index helper
ceee315
Expand test suite
44f4cd3
8000
Merge branch 'main' into sqlite-blob
220b576
Merge branch 'main' into sqlite-blob
d9b5cdf
Format docs with linewidth 80
aaa2721
Improve tests
18e5118
Merge branch 'main' into sqlite-blob
8f685ba
Add clinic_state() stub. (Currently not used)
96df661
Visit/clear blob type during module traverse/clear
97d12a8
Harden some tests, simplify others
2e63b3e
Simplify example
be27747
Update docs
5add365
Simplify tests
bacf087
Safe close
5ff202d
Condense a comment
1fa5901
Make sure we catch int overflow for all types of writes
16f4d0d
Merge branch 'main' into sqlite-blob-all
7aec288
Fix typo in test name
aaaf7ab
Improve test
f9e65c0
Improve tests
6a5c864
Always check length in inner write
ea1045c
Fix missing array sentinel
2f848d9
Match apsw's API open_blob => blobopen
8d906bc
Fix overflow test on win x64
90b75d1
Remove mapping protocol support
be34fe6
Remove context manager support
b8ab73b
Update Modules/_sqlite/blob.c
1d05c70
Don't use module; it's a C++ keyword
b48742a
Sync with main
47f7dec
Doc adjustments
703d4fd
Normalise test names
a167eb3
Doc: add a sembreak
b38f0df
Try to align docstrings and docs
1b5f953
More docstring adjustments
95b386f
Test adjustments
26c3623
Simplify read-at-offset test
fac770a
Simplify tests further
290bb18
Simplify tests further
8708b34
Doc: mapping protocol is removed in this PR
e15c087
Sync with main bco. gh-79097
a9c8928
Address review: reword docs
5c1ddfc
Address review: link with file-like object
e49b35f
Address review: spell out the subtests of test_blob_sequence_not_supp…
9e7ae6b
Use SEEK_* macros iso. magical numbers
453f522
Address review: singular => plural
154edca
Don't use magical numbers in exception messages
8000
f784a81
IT'S ESS CUE EL LITE
0bc67ed
🤦
8d834bf
Address Alex' review
2590112
Address Berker's comments from gh-271: remove unneeded class prefix
69a5a1e
Address Berker's comments from gh-271: move __len__ doc to class desc…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import sqlite3 | ||
|
||
con = sqlite3.connect(":memory:") | ||
con.execute("create table test(blob_col blob)") | ||
con.execute("insert into test(blob_col) values (zeroblob(10))") | ||
|
||
blob = con.blobopen("test", "blob_col", 1) | ||
blob.write(b"Hello") | ||
blob.write(b"World") | ||
blob.seek(0) | ||
print(blob.read()) # will print b"HelloWorld" | ||
blob.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Misc/NEWS.d/next/Library/2018-04-18-16-15-55.bpo-24905.jYqjYx.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Add :meth:`~sqlite3.Connection.blobopen` to :class:`sqlite3.Connection`. | ||
:class:`sqlite3.Blob` allows incremental I/O operations on blobs. | ||
Patch by Aviv Palivoda and Erlend E. Aasland. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.