62 Commits

Author SHA1 Message Date
Charles Leifer b0b5f1a1a2 Tests for #3044 - custom db_value in json field subclass 2026-04-23 16:12:19 -05:00
Charles Leifer aa59f6e036 Ensure avoid SQLi in timezone, add'l tests.
Also add docs to ModelSelect that were present (slightly different) on
the base Select query. Since the modelselect variants do not accept a
`database` parameter, document these separately to avoid confusion.
2026-03-15 21:49:34 -05:00
Charles Leifer 5ad08999ad Improvements to BinaryJSONField - remove() subelements, length, extract. 2026-03-11 22:30:10 -05:00
Charles Leifer 58ba089af4 Add support for jsonb remove on a sub-path.
Equivalent to BinaryJSONField.remove(p1, p2)
2026-03-11 21:56:27 -05:00
Charles Leifer a77f02d1c0 Add back support for customizing json dumps w/postgres.
Fixes #3032
2026-02-28 20:10:43 -06:00
Charles Leifer b221d20302 Fix array slicing in postgres. 2026-02-24 13:00:37 -06:00
Charles Leifer 930f769979 Database docs also cleaned up postgres isolation level handling. 2026-02-20 18:35:23 -06:00
Charles Leifer f62a41a57d Cleanup and normalize postgres JSON handling.
Prefer the driver-provided wrappers, e.g. psycopg.types.json.* as these
can help when binding and eliminate need for casts. psycopg2 still needs
a cast, so unfortunately I've had to parameterize the to_value()
method...but whatever, it's better than it was.
2026-02-16 16:53:36 -06:00
Charles Leifer 9eb73c7973 Few cleanups to server-side cursor stuff. 2026-02-15 22:15:02 -06:00
Charles Leifer a215702e35 More test and import cleanup re: psycopg3 2026-02-15 21:55:07 -06:00
Charles Leifer f56cb40c87 Unify psycopg2 & psycopg3 handling in Postgresql db classes. 2026-02-15 21:07:01 -06:00
Charles Leifer efc7d124ae Fix issue w/github actions not having timezone definitions. 2025-09-08 16:16:50 -05:00
Charles Leifer 60bcd81e86 Fix failing tests in 3.14
Looks like 3.14a4 is failing due to the evaluation of a functools.partial()
Not sure what the problem is.

Fixes #2969
2025-02-05 10:26:27 -06:00
Charles Leifer c6f4c4da7a Fix ServerSide query regression introduced in 3.16.0
Fixes #2899
2024-05-22 08:04:28 -05:00
Charles Leifer 2e67aec657 Add test for not setting index=True in reflecting unindexed jsonb. 2023-03-10 18:08:59 -06:00
Charles Leifer 69678447d8 Run psycopg2 in autocommit and fully take over txn management.
This is similar to what we currently do for sqlite3 - rather than
relying on the db-api transaction management under-the-hood, calling
commit as necessary, we take over the transaction management ourselves.
The semantics should be the same, but ideally with less performance
impact as the driver is issuing fewer BEGIN/COMMITs. This also has the
benefit of not leaving connections in the "InternalError: Current
transaction is aborted" state for "top-level" queries outside of
transactions.

This also removes the db-api-specific cruft in execute_sql() and assumes
that overrides will be put into autocommit-mode. We'll retain the db-api
stuff for MySQL for now, at any rate.
2023-02-11 22:34:55 -06:00
Charles Leifer 146f3429dc Add ArrayField.contained_by() ("<@" operator) for Postgres.
Fixes #2497
2021-12-03 11:10:31 -06:00
Charles Leifer efb41a944e Add test-case for jsonb contains within list. 2020-11-19 09:20:26 -06:00
Charles Leifer 86d35f315a Add lateral() method to select query for use in lateral joins.
Refs #2205
2020-06-16 10:24:51 -05:00
Charles Leifer 7eb7498018 Allow array indices / lookup nodes to be used as dict keys.
Fixes #2158
2020-04-23 19:27:35 -05:00
Charles Leifer 89dd9c89fd Ensure JSONField.concat() accepts expressions.
Fixes #2133
2020-03-17 12:59:55 -05:00
Charles Leifer 55ef182840 Support indexing into arrays using expressions w/Postgres.
Fixes #2085
2020-01-13 12:51:28 -06:00
Charles Leifer 528b1a2fb5 Refactor JSON field tests and run on CRDB. 2019-12-03 18:33:07 -06:00
Charles Leifer 8829c9483f Add support for LATERAL JOIN and update relevant doc section. 2019-12-03 10:57:31 -06:00
Charles Leifer 22324cf27d Add new to_value() interface to help with mapping fields->values.
Fixes #2033, #2034
2019-10-09 08:49:38 -05:00
Charles Leifer c01d08528a Add support for materialized/not materialized CTEs. 2019-10-03 16:20:06 +00:00
Charles Leifer 3a98fcf992 IdentityField already exists in peewee! Update and fix tests.
Refs #2028
2019-10-01 10:50:27 -05:00
Charles Leifer d46a5e28e0 Add IdentityField to postgres_ext along with tests.
References #2028
2019-09-30 15:31:16 -05:00
Charles Leifer ef27f0209a Improve the data-type conversion for JSON values. 2019-08-01 09:58:28 -05:00
Charles Leifer 9fb1c89353 APIs for managing isolation level in postgres.
Refs #1972
2019-07-22 04:34:16 -05:00
Charles Leifer 0c3ea7a06d Add set_time_zone() method to PostgresqlDatabase. 2019-04-16 10:04:21 -05:00
Charles Leifer 244b78f432 Additional assertions re: changing connection tz. 2019-04-16 10:01:41 -05:00
Charles Leifer 677139650b Add better tests for postgres DateTimeTZField. 2019-04-16 09:58:41 -05:00
Charles Leifer b08726b44d Fix postgres tests. 2019-04-12 11:52:30 -05:00
Charles Leifer 1390a098fc Add a few autocommit-related integration tests. 2019-04-11 23:02:41 -05:00
Charles Leifer fa8fc729f3 Support plainto_tsquery. Replaces #1894.
Thanks to @kkinder for suggestion and initial patch.
2019-03-25 16:19:54 -05:00
Charles Leifer 4450202e59 Support index_type on all Field classes.
Fixes #1851
2019-02-11 15:52:40 -06:00
Charles Leifer 04aa7a0de6 Invoke operator overloads when generating filter expressions.
Fixes #1817
2018-12-20 09:34:13 -06:00
Charles Leifer f59ee6d1c5 Ensure conversions are applied to ON CONFLICT...UPDATE data-types.
Fixes #1815
2018-12-18 21:31:23 -06:00
Charles Leifer f9bd512643 Add test case using on_conflict with BinaryJSONField.
Refs #1815
2018-12-18 21:14:47 -06:00
Charles Leifer 2ebd866cc2 Test doing in-place update via concat for BinaryJSONField. 2018-12-03 08:57:58 -06:00
Charles Leifer 47438e14bc Default to using GIN indexes for indexed types, including hstore. 2018-11-21 16:05:04 -06:00
Charles Leifer c9895423a3 Call pg10()? wtf 2018-11-21 15:12:09 -06:00
Charles Leifer 6dd3de2e39 Require pg10 for remove tests. 2018-11-21 15:05:48 -06:00
Charles Leifer 69f55be83b concat, has_key and remove for BinaryJSONField. 2018-11-21 14:45:12 -06:00
Charles Leifer b136f2df72 Register UUID type and test native array of UUIDs. 2018-07-23 14:17:24 -05:00
Charles Leifer 4ebaccd4a3 Test array of UUIDs with Postgres. 2018-07-23 14:12:56 -05:00
Charles Leifer d0f73d09d8 Better conversion of class name to snake-case table names.
Add test-case for new table-naming function.
2018-06-28 16:35:38 -05:00
Charles Leifer ad94047fa0 Add field_kwargs parameter to ArrayField initializer.
Fixes #1608.
2018-05-19 22:48:01 -05:00
Charles Leifer 967eb514ee Standardize test skipping implementation. 2018-05-01 16:31:07 -05:00