110 Commits

Author SHA1 Message Date
Joseph Gardi 5df61d335f fix earlier commit 2026-02-08 19:46:24 -08:00
Joseph Gardi a1ebddef8a Fix transaction context manager to re-raise exceptions after rollback
The except block was swallowing exceptions silently after rolling back
the transaction. Added `raise` to propagate the exception to the caller.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 12:56:11 -08:00
kennethreitz 9e0d8bc244 Update SQLAlchemy version and modify test fixture 2024-03-29 19:37:25 -04:00
kennethreitz 461b245973 Merge pull request #215 from python-pitfalls/master
removed a manual indexer iterator pitfall
2024-03-29 19:06:25 -04:00
kennethreitz 7e0be6d383 Merge pull request #219 from prasad83/master
Fixed query execute & result for Sqlachemy 2.0
2024-03-29 19:05:30 -04:00
kennethreitz 27ea234ab4 Merge pull request #154 from arokosaki/master
fix for RecordCollection slicing bug
2024-03-29 19:05:18 -04:00
kennethreitz 332273d8b0 Merge pull request #172 from keelanfh/master
Pass kwargs to get_table_names function
2024-03-29 19:04:47 -04:00
kennethreitz 491b234ecc Merge pull request #190 from shacknetisp/closed_149
Use close_with_result rather than closing connections too early. (Fixes the sqlite error.)
2024-03-29 19:02:30 -04:00
kennethreitz 677d8e5e18 Merge pull request #199 from kingaj12/patch-1
Update records.py
2024-03-29 19:01:05 -04:00
prasad83 25ccf2e14d Fix for string based key lookup with sqlachemy 2.0
Should use wrapped _keys instead of keys()
2023-05-02 20:41:47 +05:30
prasad83 c03e2bf950 Fixed query execute with params for Sqlachemy 2.0
Sqlachemy 2.x expects parameters be bound to statement (=text(query))
2023-05-02 20:13:38 +05:30
WangWeigao ce3be02cce Compatible with SQLAlchemy 1.4.*
Compatible with SQLAlchemy 1.4.*
2021-12-16 16:40:18 +08:00
Naelson Douglas 0dc011e965 removed a manual indexer iterator pitfall 2021-10-19 16:07:29 -03:00
Alan King 63f23920dd Update records.py
added a "get_engine()" method
2020-08-12 01:05:12 -04:00
Beha ee04fb2468 Use close_with_result rather than closing connections too early. 2020-01-06 08:24:39 -05:00
fritz-clicktripz 3ae59e78c5 Update records.py
Addresses issue https://github.com/kennethreitz/records/issues/179
2019-05-23 12:31:23 -04:00
Keelan Fadden-Hopper 9d1e1b8eed Pass kwargs to get_table_names function
When using the `get_table_names` function, the function currently will not allow the user to pass in the `schema` argument. This means that, for instance, you can't get the table names for a PostgreSQL schema other than the default schema. This feature could be added quite easily.
2019-02-13 11:50:45 +00:00
arokosaki d47f7b8d33 fix records.RecordCollection slicing bug 2018-06-17 23:56:06 +03:00
mcdallas abdeb7e8c8 reuse code from .first() in .one() 2018-04-27 14:44:35 +01:00
Jan Vlcinsky 598af0df4a Fix #78: printing resulting bytes under python3
Binary outputs were printed as repr with b'abcde' instead as real bytes.
2018-04-13 22:33:53 +02:00
Jan Vlcinsky fd5f379e45 Handle failures caused by missing package (required by db or format) 2018-04-12 22:17:39 +02:00
Jan Vlcinsky d3ba8526b3 CLI handling. Fix #133, check <format> is supported one. 2018-04-12 21:27:54 +02:00
Joakim Uddholm d5adf51cfe More helpful error message for RecordCollection.one 2018-02-15 00:49:59 +01:00
Joakim Uddholm de6f80e70b First changed so that it doesn't check that it is the only row. Old behaviour is now in the new method 'one()' instead. 'scalar' uses old behaviour still 2018-02-15 00:42:07 +01:00
kennethreitz fe0ed3199d Merge pull request #119 from gdtroszak/proper-pooling
Properly handle SQLAlchemy connection pools
2018-02-13 07:39:42 -06:00
Joakim Uddholm d1b76caaab Add scalar method to RecordCollection 2018-02-11 17:33:39 +01:00
kennethreitz cf131a971f Merge pull request #118 from dschep/master
Raise an error if selecting column that exists more than once
2017-12-11 07:14:50 -05:00
wanpeng b21aa145d1 Fix multiple Single quotation mark error 2017-12-11 20:11:40 +08:00
Greg Troszak 3d47e45f1e Throw exception if db closed. 2017-12-09 13:14:59 -08:00
Greg Troszak 522199af20 Clean up. 2017-12-09 08:48:14 -08:00
Greg Troszak 89ef187b3c Properly handle connection pools with txs. 2017-12-09 08:22:07 -08:00
Daniel Schep 01d0132c1f Raise an error if selecting column that exists more than once
This caused a pretty major bug for us

also, closes #108
2017-12-07 11:48:38 -05:00
Sean Behan d7025002d6 Fix indentation error 2017-09-01 21:05:42 -04:00
kennethreitz dd581ff21a Update records.py 2017-08-30 13:51:20 -04:00
kennethreitz 3d478e1506 Merge pull request #103 from restran/master
add support for bulk insert and update.
2017-08-27 04:04:33 -04:00
kennethreitz 1e2e03b3fd cleanup 2017-07-28 22:16:44 -04:00
restran 0421d96a1a add support for bulk insert and update. 2017-04-18 15:58:04 +08:00
kennethreitz 0e4a6493d4 Merge pull request #97 from RazerM/fix_get_table_names
Reuse engine for get_table_names, use inspection instead of metadata reflection
2017-02-04 13:27:32 -06:00
kennethreitz 9ab584822b Merge pull request #99 from Stranger6667/simple-improvement
Return value immediately
2017-02-04 13:26:16 -06:00
Edward Makhlin 93cb81991a Fixed accidental StopIteration bubbling in RecordCollection.__iter__
For more info check this PEP: https://www.python.org/dev/peps/pep-0479/
2017-02-04 01:21:49 +03:00
Dmitry Dygalo 39283b6e07 Return value immediately 2017-01-25 10:05:39 +01:00
Frazer McLean aa6587f665 Remove unused import 2017-01-24 20:58:53 +01:00
Frazer McLean 2b3213c06f Reuse engine for get_table_names, use inspection instead of metadata.
Resolves #74.
2017-01-24 20:24:43 +01:00
kennethreitz 27d8efd200 Merge pull request #91 from TomFaulkner/patch-1
CLI function docstring requires format should be optional
2017-01-06 13:54:16 -05:00
kennethreitz 42a7e78dc0 fix dir for super 2016-12-20 13:02:30 -05:00
TomFaulkner 39036fcb8a CLI function docstring requires format should be optional
Changed line 327 to have format as optional parameter as lines 385-389 imply should be the case.
Old: records <query> <format> [<params>...] [--url=<url>]
New: records <query> [<format>] [<params>...] [--url=<url>]
2016-12-19 15:15:28 -06:00
Chad Whitacre 617f02c621 Prune unused imports while we're here 2016-11-21 19:45:09 -05:00
Chad Whitacre 3b7438f130 Update docstring/comment re: raising default 2016-11-21 19:41:51 -05:00
Chad Whitacre 7588c1ca2b Rename .one to .first 2016-11-21 19:41:22 -05:00
Chad Whitacre 85fbec787a Switch to index access for idiomaticity 2016-11-21 19:33:31 -05:00