summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_sqlite3
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-118221: Always use the default row factory in sqlite3.iterdump() ↵Erlend E. Aasland2024-04-251-0/+15
| | | | | | | | | | | | | | (#118223) (#118270) sqlite3.iterdump() depends on the row factory returning resulting rows as tuples; it will fail with custom row factories like for example a dict factory. With this commit, we explicitly reset the row factory of the cursor used by iterdump(), so we always get predictable results. This does not affect the row factory of the parent connection. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-117995: Don't raise DeprecationWarnings for indexed nameless ↵Miss Islington (bot)2024-04-221-0/+14
| | | | | | | | | | params (GH-118001) (#118142) Filter out '?NNN' placeholders when looking for named params. (cherry picked from commit 550483b7e6c54b2a25d4db0c4ca41bd9c1132f93) Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: AN Long <aisk@users.noreply.github.com>
* [3.12] gh-108617: Extend interactive session tests for sqlite3 (GH-108556) ↵Miss Islington (bot)2023-08-291-6/+32
| | | | | | | | | (#108626) gh-108617: Extend interactive session tests for sqlite3 (GH-108556) (cherry picked from commit ecb2bf02a4a564b638f756ce6e644ec17b6edf16) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-108558: Improve sqlite3 row factory tests (GH-108578) (#108615)Miss Islington (bot)2023-08-291-14/+11
| | | | | | | | | | | | | | | | | | | | | | * gh-108558: Improve sqlite3 row factory tests (GH-108578) Add test_sqlite_row_keys() to explicitly test sqlite3.Row.keys(). Cleanups: - Reduce test noise by converting docstrings to regular comments - Reduce boilerplate code by adding a setUp() method to RowFactoryTests (cherry picked from commit 6eaddc10e972273c1aed8b88c538e65e4773496e) Co-authored-by: Edward Schauman-Haigh <142528725+EddInSverige@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend@python.org> * Fix backport --------- Co-authored-by: Edward Schauman-Haigh <142528725+EddInSverige@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend@python.org>
* [3.12] gh-108550: Speed up sqlite3 tests (GH-108551) (#108566)Miss Islington (bot)2023-08-283-98/+68
| | | | | | | | | | | | | | | | | | gh-108550: Speed up sqlite3 tests (GH-108551) Refactor the CLI so we can easily invoke it and mock command-line arguments. Adapt the CLI tests so we no longer have to launch a separate process. Disable the busy handler for all concurrency tests; we have full control over the order of the SQLite C API calls, so we can safely do this. The sqlite3 test suite now completes ~8 times faster than before. (cherry picked from commit 0e8b3fc718c8a1c4de558c553d9e05049c1dbec6) Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-64662: Fix virtual table support in sqlite3.Connection.iterdump ↵Erlend E. Aasland2023-08-281-0/+20
| | | | | | | | | | | | | | | | | | | (#108340) (#108563) * [3.12] gh-64662: Add virtual table support to sqlite3.Connection.iterdump (#108340) (cherry picked from commit d0160c7c22c8dff0a61c49b5304244df6e36465e) Co-authored-by: Aviv Palivoda <palaviv@gmail.com> * The _quote_value helper is not part of 3.12; spell out the replacement * With quotes * Ok, let's use explicit quoting --------- Co-authored-by: Aviv Palivoda <palaviv@gmail.com>
* [3.12] gh-105557: Remove duplicate sqlite3 test method (GH-105558) (#105561)Miss Islington (bot)2023-06-091-7/+2
| | | | | | | test_func_return_too_large_int() was defined twice. Keep only the redefined method, as that also checks the tracebacks. (cherry picked from commit b8fa7bda4f286503447dc12327b789bbfc836458) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-100370: fix OverflowError in sqlite3.Connection.blobopen for 32-bit ↵Erlend E. Aasland2023-05-071-0/+8
| | | | builds (#103902)
* GH-103857: Deprecate utcnow and utcfromtimestamp (#103858)Paul Ganssle2023-04-271-1/+1
| | | | | Using `datetime.datetime.utcnow()` and `datetime.datetime.utcfromtimestamp()` will now raise a `DeprecationWarning`. We also have removed our internal uses of these functions and documented the change.
* gh-103489: Add get/set config methods to sqlite3.Connection (#103506)Erlend E. Aasland2023-04-261-0/+24
|
* GH-103805: Lib test f541 linting issue fix (#103812)Rodolfo M. Pereira2023-04-242-4/+4
| | | | | | | | | | | | | | | | This PR makes some minor linting adjustments to the Lib/test module caught by [ruff](https://github.com/charliermarsh/ruff). The adjustments are all related to the `F541 f-string without any placeholders` issue. Issue: https://github.com/python/cpython/issues/103805 <!-- gh-issue-number: gh-103805 --> * Issue: gh-103805 <!-- /gh-issue-number --> --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-101947: Remove size check from sqlite3 serialize test (#102914)Erlend E. Aasland2023-03-221-1/+0
| | | The size of the returned data is too implementation specific.
* gh-101693: In sqlite3, deprecate using named placeholders with parameters ↵Erlend E. Aasland2023-02-151-0/+15
| | | | supplied as a sequence (#101698)
* gh-100553: Improve accuracy of sqlite3.Row iter test (#100555)Nikita Sobolev2022-12-281-2/+8
|
* gh-99659: Use correct exceptions in sqlite3 bigmem tests (#99660)Łukasz Langa2022-11-211-4/+4
| | | | | | The tests in question were added in 0eec6276fdcd by Serhiy. Apparently, sqlite3 changed exceptions raised in those cases in the mean time but the tests never ran because they require a high `-M` setting in the test runner.
* gh-83638: Add sqlite3.Connection.autocommit for PEP 249 compliant behaviour ↵Erlend E. Aasland2022-11-121-0/+173
| | | | | | | | | | (#93823) Introduce the autocommit attribute to Connection and the autocommit parameter to connect() for PEP 249-compliant transaction handling. Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM> Co-authored-by: Géry Ogam <gery.ogam@gmail.com>
* gh-77617: Add sqlite3 command-line interface (#95026)Erlend Egeberg Aasland2022-08-011-0/+155
| | | Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-95132: Correctly relay *args and **kwds from sqlite3.connect to factory ↵Erlend Egeberg Aasland2022-07-231-0/+20
| | | | | | | | | | | | (#95146) This PR partially reverts gh-24421 (PR) and fixes the remaining concerns given in gh-93044 (issue): - keyword arguments are passed as positional arguments to factory() - if an argument is not passed to sqlite3.connect(), its default value is passed to factory() Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-90016: Deprecate default sqlite3 adapters and converters (#94276)Erlend Egeberg Aasland2022-07-202-11/+26
| | | Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
* gh-94998: Remove redundant condition in test_sqlite3/__main__.py (#95052)Erlend Egeberg Aasland2022-07-201-2/+1
|
* gh-93370: Don't print deprecated pysqlite version in test_sqlite3 (#95017)Erlend Egeberg Aasland2022-07-191-3/+1
|
* gh-84461: Fix test_sqlite for Emscripten/WASI (#94125)Christian Heimes2022-06-231-1/+8
|
* gh-84623: Remove unused imports (#94132)Victor Stinner2022-06-221-1/+1
|
* gh-94028: Clear and reset sqlite3 statements properly in cursor iternext ↵Erlend Egeberg Aasland2022-06-211-0/+39
| | | | (GH-94042)
* gh-79009: sqlite3.iterdump now correctly handles tables with autoincrement ↵itssme2022-06-191-0/+47
| | | | | (#9621) Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-93795: Use test.support TESTFN/unlink in sqlite3 tests (#93796)Erlend Egeberg Aasland2022-06-141-17/+15
|
* gh-79579: Improve DML query detection in sqlite3 (#93623)Erlend Egeberg Aasland2022-06-141-10/+56
| | | | | | | | | The fix involves using pysqlite_check_remaining_sql(), not only to check for multiple statements, but now also to strip leading comments and whitespace from SQL statements, so we can improve DML query detection. pysqlite_check_remaining_sql() is renamed lstrip_sql(), to more accurately reflect its function, and hardened to handle more SQL comment corner cases.
* gh-84623: Remove unused imports in tests (#93772)Victor Stinner2022-06-131-1/+0
|
* gh-93421: Update sqlite3 cursor.rowcount only after SQLITE_DONE (#93526)Erlend Egeberg Aasland2022-06-081-0/+8
|
* gh-93370: Deprecate sqlite3.version and sqlite3.version_info (#93482)Kalyan2022-06-071-0/+11
| | | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-93117: Remove too large sqlite3 bigmemtest (#93154)Erlend Egeberg Aasland2022-05-251-8/+1
|
* GH-93115: Fix version check in sqlite3 module constants test (#93116)Florian Bruhin2022-05-231-18/+18
|
* Clean up the sqlite3 tests (GH-93056)Serhiy Storchaka2022-05-212-33/+23
| | | | Remove helper managed_connect(). Use memory_database() or contextlib.closing() + addCleanup(unlink) instead.
* Improve tests for opening Sqlite by URI (GH-93047)Serhiy Storchaka2022-05-211-5/+42
| | | | * Test with with escaped non-ascii characters * Test read-only open of existing DB.
* gh-93044: No longer convert the database argument of sqlite3.connect() to ↵Serhiy Storchaka2022-05-211-0/+13
| | | | | bytes (GH-93046) Just pass it to the factory as is.
* gh-91922: Fix sqlite connection on nonstardard locales and paths (GH-92926)Serhiy Storchaka2022-05-201-11/+17
|
* gh-92547: Remove deprecated sqlite3 features (#92548)Erlend Egeberg Aasland2022-05-162-21/+0
| | | | | | | | | | The following sqlite3 features were deprecated in 3.10, scheduled for removal in 3.12: - sqlite3.OptimizedUnicode (gh-23163) - sqlite3.enable_shared_cache (gh-24008) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Signed-off-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-89022: Improve sqlite3 exceptions related to binding params and API ↵Erlend Egeberg Aasland2022-05-042-5/+5
| | | | | | | | | | | | | misuse (#91572) * Map SQLITE_MISUSE to sqlite3.InterfaceError SQLITE_MISUSE implies misuse of the SQLite C API, which, if it happens, is _not_ a user error; it is an sqlite3 extension module error. * Raise better errors when binding parameters fail. Instead of always raising InterfaceError, guessing what went wrong, raise accurate exceptions with more accurate error messages.
* gh-80254: Disallow recursive usage of cursors in `sqlite3` converters (#29054)Erlend Egeberg Aasland2022-05-031-0/+39
| | | | Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-89301: Fix regression with bound values in traced SQLite statements (#92053)Erlend Egeberg Aasland2022-05-021-1/+61
|
* gh-92019: Make sqlite3.Blob indexing conform with the norm (#92020)Erlend Egeberg Aasland2022-04-301-22/+29
| | | | | | - get index now returns an int - set index now requires an int in range(0, 256) Resolves #92019
* gh-69093: Add indexing and slicing support to sqlite3.Blob (#91599)Erlend Egeberg Aasland2022-04-221-4/+134
| | | | Authored-by: Aviv Palivoda <palaviv@gmail.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@innova.no>
* gh-69093: Add context manager support to sqlite3.Blob (GH-91562)Erlend Egeberg Aasland2022-04-161-0/+23
|
* gh-69093: Don't allow instantiation of sqlite3.Blob objects (GH-91570)Erlend Egeberg Aasland2022-04-151-0/+1
|
* gh-69093: Expose sqlite3.Blob as a class (GH-91550)Jelle Zijlstra2022-04-151-0/+3
| | | | I noticed this was missing while writing typeshed stubs. It's useful to expose it for use in annotations and for exploration.
* gh-69093: Support basic incremental I/O to blobs in `sqlite3` (GH-30680)Erlend Egeberg Aasland2022-04-151-1/+156
| | | | | | | Authored-by: Aviv Palivoda <palaviv@gmail.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@innova.no> Co-authored-by: palaviv <palaviv@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-79097: Add support for aggregate window functions in sqlite3 (GH-20903)Erlend Egeberg Aasland2022-04-122-5/+165
|
* bpo-41930: Add support for SQLite serialise/deserialise API (GH-26728)Erlend Egeberg Aasland2022-04-051-0/+55
| | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-44859: Raise more accurate exceptions in `sqlite3` (GH-27695)Erlend Egeberg Aasland2022-03-173-9/+28
| | | | | | | | | | | | * Improve exception compliance with PEP 249 * Raise InterfaceError instead of ProgrammingError for SQLITE_MISUSE. If SQLITE_MISUSE is raised, it is a sqlite3 module bug. Users of the sqlite3 module are not responsible for using the SQLite C API correctly. * Don't overwrite BufferError with ValueError when conversion to BLOB fails. * Raise ProgrammingError instead of Warning if user tries to execute() more than one SQL statement. * Raise ProgrammingError instead of ValueError if an SQL query contains null characters. * Make sure `_pysqlite_set_result` raises an exception if it returns -1.
* bpo-45138: Revert GH-28240: Expand traced SQL statements (GH-31788)Erlend Egeberg Aasland2022-03-091-60/+1
| | | | | This reverts commit d1777515f9f53b452a4231d68196a7c0e5deb879. Automerge-Triggered-By: GH:JelleZijlstra