Commit Graph

359 Commits

Author SHA1 Message Date
Friedrich Lindenberg
f2e62606c7 new version 2017-10-25 23:06:31 +02:00
Friedrich Lindenberg
7a69baf491 Merge pull request #224 from emanuelfeld/master
Check if primary column on first _sync_table call
2017-09-30 12:01:14 +02:00
Stefan Wehrmeyer
da901efbf7 Remove Python 2.6 support code 2017-09-29 14:11:07 +02:00
emanuelfeld
753d4a28d4 Check if primary column on first _sync_table call
Checks if column is primary key column on table creation, before
attempting to add again as non-primary key column.
2017-09-28 23:57:48 -04:00
Friedrich Lindenberg
1fd19f37b9 extra check before column creation 2017-09-24 10:41:08 +03:00
Friedrich Lindenberg
39da7522cb create table upon create_column, fixes #220. 2017-09-14 20:17:01 -03:00
Friedrich Lindenberg
44b49a6bb9 build instructions. 2017-09-09 18:40:47 +02:00
Friedrich Lindenberg
fc59bc59e6 Fix up imports, refs #217. 2017-09-09 18:34:32 +02:00
Friedrich Lindenberg
a049691749 Remove datafreeze component, fixes #217 2017-09-09 18:24:34 +02:00
Friedrich Lindenberg
cd091eadca Missing check on self.local. 2017-09-05 07:59:02 +02:00
Friedrich Lindenberg
ffea0f7a69 Warn about mixing transactions, schema changes and threading. 2017-09-05 07:49:05 +02:00
Friedrich Lindenberg
e5b3cd5f49 fix transaction metadata bug 2017-09-04 22:55:12 +02:00
Friedrich Lindenberg
7e614c0933 cleanup inspection code 2017-09-04 22:26:51 +02:00
Friedrich Lindenberg
df0d79d75c fix _step bug 2017-09-04 10:57:01 +02:00
Friedrich Lindenberg
4232606d27 Move to a model where the table is created lazily, with an initial set of columns 2017-09-03 23:23:57 +02:00
Friedrich Lindenberg
e30cf24195 Rewrite data change functions on table. 2017-09-03 10:05:17 +02:00
Friedrich Lindenberg
213a7ce857 Use introspection for table indexes. 2017-09-02 23:05:50 +02:00
Friedrich Lindenberg
37d7f47d39 Make table instances singleton-ish. 2017-09-02 22:35:29 +02:00
Friedrich Lindenberg
13cbff37fe Fix postgres errors. 2017-09-02 20:33:11 +02:00
Friedrich Lindenberg
a2748b7fde Reduce dependence on internal metadata caching, refs #208. 2017-09-02 19:35:01 +02:00
Friedrich Lindenberg
47cdf52323 fix mysql issue, test no-column table. 2017-09-02 17:25:52 +02:00
Friedrich Lindenberg
cc7787036b still more cases of using the engine and not the executable in transaction 2017-09-02 17:17:24 +02:00
Friedrich Lindenberg
17ef44485d Explicitly not that string types are unsupported. 2017-09-02 16:48:53 +02:00
Friedrich Lindenberg
a4c73a8fb8 Begin implementing a types handler instead of using plain text types.
this is potentially BREAKING scripts which use the string syntax.
2017-09-02 16:47:04 +02:00
Friedrich Lindenberg
54dc192244 allow mixed-case column names, fixes #188 2017-09-02 08:39:52 +02:00
Friedrich Lindenberg
edc41e4d82 Merge branch 'master' into create_column_by_example 2017-09-02 08:22:22 +02:00
Stefan Wehrmeyer
3f330df20f Check for clauses and filters in delete
Guard against wrong API use before dropping all data
2017-05-16 16:57:07 +02:00
Friedrich Lindenberg
77762266dd Simplify transactional logging code, fix deadlock situation. 2017-01-29 17:31:04 +01:00
Friedrich Lindenberg
522415a27c refactor query code to be simpler 2017-01-29 15:45:18 +01:00
Joe Schmid
c3158d7fe1 Allow Date column type (in addition to existing DateTime type) 2016-12-05 14:14:47 -05:00
Friedrich Lindenberg
27af456be7 get over weird lint error 2016-11-21 08:47:41 +01:00
Paul M Furley
866713f110 Order JSON freeze fields deterministically
To avoid commits like [this
one](f0599f87bc)
on Python 3
2016-11-21 07:30:43 +00:00
Paul Fitzpatrick
94bc6e09c0 add Table.create_column_by_example method
This adds a method to create a column by giving an example of
the data it will contain rather than by specifying its
SQLAlchemy type.  This extends the range of operations that
can be performed without reading the SQLAlchemy docs.
2016-10-26 09:29:55 -04:00
Friedrich Lindenberg
5c04bd1e5d allow for **kwargs in create_index, refs #172. 2016-09-24 10:44:49 +02:00
Friedrich Lindenberg
2eaa3403ff Merge pull request #172 from jsvine/master
Let users pass `unique` boolean to .create_index
2016-09-24 10:41:07 +02:00
Friedrich Lindenberg
8032c66219 Merge pull request #179 from johnlpuc163/master
bug fix, make Table.drop_column be aware of table schema
2016-09-22 17:57:16 +02:00
Friedrich Lindenberg
2928ba4f39 Merge pull request #180 from arturhoo/patch-1
Fix typo on #create_column
2016-09-22 17:56:51 +02:00
Florent Bervas
458d086db5 import decimal module 2016-08-10 14:20:06 +02:00
Florent Bervas
e36f26a72c handle Decimal class as a string to avoid "null" as returned value 2016-08-09 16:47:33 +02:00
Artur Rodrigues
0046bcb428 Fix typo on #create_column 2016-07-27 23:24:30 +01:00
Xu Liu
4147871b39 bug fix, make Table.drop_column be aware of table schema 2016-07-26 17:59:30 -04:00
Friedrich Lindenberg
927f88bbd5 work in row pruning, fixes #176 2016-07-03 11:18:17 +02:00
Jeremy Singer-Vine
fc26d7afcd Let users pass unique boolean to .create_index 2016-05-24 14:11:26 -04:00
Friedrich Lindenberg
5f1a38a15f Merge pull request #169 from saun4app/feature_insert_ignore
Added insert_ignore and changed upsert.
2016-05-14 08:57:21 +02:00
Saun Shewanown
72b01df60d Fixed Build Jobs Build #186 blank space errors 2016-04-27 16:48:45 -04:00
Saun Shewanown
e7f45b2a68 Added error check to _upsert_pre_check(), res = None when error 2016-04-27 16:39:50 -04:00
Saun Shewanown
7fd1a71506 Corrected upsert logical error. 2016-04-23 07:59:25 -04:00
Saun Shewanown
9c162a056c Changed upsert code style. The logic should be the same. 2016-04-22 14:13:52 -04:00
Saun Shewanown
66547aafb5 Fixed Build Jobs Build #182 errors 2016-04-22 13:04:17 -04:00
Saun Shewanown
ff9bed01f1 Fixed Build Jobs Build #181 errors 2016-04-22 12:57:35 -04:00
Saun Shewanown
c1e82bb9ae Added insert_ignore and changed upsert. 2016-04-22 11:35:14 -04:00
Friedrich Lindenberg
fb48c914f4 fix regression, fixes #168 2016-04-22 15:45:10 +02:00
Friedrich Lindenberg
bdd937e2c9 pep8 2016-04-10 10:25:14 +03:00
Friedrich Lindenberg
b64837e2e2 Merge pull request #165 from jmerkow/rtn_query
Simple change in table.py to return query from find
2016-04-10 10:12:27 +03:00
Friedrich Lindenberg
4fcb7f55ed use staticPool for sqlite, fixes #163 2016-04-10 10:08:58 +03:00
Jameson Merkow
2fa5f5f1d4 Simple change in table.py to return query from find 2016-04-09 15:16:10 -07:00
Friedrich Lindenberg
38aef065cb add to dataset.connect 2016-04-08 11:14:03 +03:00
Friedrich Lindenberg
4fb4845efc set default of the ensure_schema flag per session 2016-04-08 09:23:24 +03:00
krkhnh
6909ba5c2f Update table.py
This propose is based on issue #133. Added 'ensure_session' global variable as a default value for 'ensure' parameter.

I haven't used Python for a long time and I can't test this code for now. I'm sorry for my irresponsibility, but here is a rough idea as a solution.
2016-04-08 09:48:27 +09:00
ryneeverett
1565fe5fe2 Implement comparison operators. Resolve #128. 2016-03-24 17:57:26 -05:00
Friedrich Lindenberg
dcf1e09bbe python 3 urllib 2016-02-14 11:19:19 +01:00
Friedrich Lindenberg
9c316ff7a6 Merge pull request #152 from twds/master
Release all the locks acquired by transaction on commit/rollback
2016-02-12 18:14:34 +01:00
Friedrich Lindenberg
e192e3f0dc provide consistent return values, fixes #138 2016-02-12 18:12:22 +01:00
Friedrich Lindenberg
cc742b7a00 do not create columns upon find(), fixes #143 2016-02-12 18:10:50 +01:00
Friedrich Lindenberg
c45b98d862 remove password from conn URLs, fixes #157 2016-02-12 17:58:55 +01:00
Friedrich Lindenberg
d460e7ca55 use qualified table name, fixes #156 2016-02-12 17:44:43 +01:00
Di Wu
7fa056bfe2 Release all the locks acquired by transaction on commit/rollback 2016-01-26 15:02:19 +08:00
Friedrich Lindenberg
af1e675e24 satisfy the pep8 checker 2016-01-19 18:19:13 +01:00
Paul Morelle
32257f96ff Remove specific params from ds.freeze() signature
Add documentation to retrieve them more easily.
References pudo/dataset#150
2016-01-18 23:13:25 +01:00
Friedrich Lindenberg
91d587849d merge 2016-01-18 11:19:13 +01:00
Friedrich Lindenberg
4f00db572f work around a bunch of bugs; 2016-01-18 11:14:30 +01:00
Friedrich Lindenberg
ef2ce6387f keep tables only in memory. 2016-01-18 11:07:24 +01:00
Friedrich Lindenberg
bd3a19ebc4 Fix python 2 support for StringIO. 2016-01-18 10:56:35 +01:00
Paul Morelle
998a712242 When wrap is False, don't wrap JSON result
Test and solution for issue pudo/dataset#149
2016-01-18 05:59:07 +01:00
Paul Morelle
18bd08c009 dataset.freeze should not close provided fileobj
Test and solution for issue pudo/dataset#147
2016-01-18 05:11:24 +01:00
Stefan Wehrmeyer
d16f1df8cd Don't call fetch on closed result proxy
"The DBAPI cursor will be closed by the ResultProxy when all of its result rows (if any) are exhausted"
See http://docs.sqlalchemy.org/en/latest/core/connections.html
2015-12-20 13:15:39 +01:00
Di Wu
b8980221cd fix infinite recursion 2015-12-20 13:49:07 +08:00
Stefan Wehrmeyer
0f7e7dc73c Flake8 cleanup 2015-12-19 21:43:51 +01:00
Di Wu
6f4f0313a8 Use fetchmany to prevent huge tables from being loaded into memory at once. 2015-12-13 20:51:14 +08:00
Friedrich Lindenberg
93162ac6fc add schema hint to create_column, refs #78 (thanks @smnorris) 2015-08-07 12:18:50 +02:00
Víctor Guzmán
b2dc8a3315 release lock in table.py 2015-07-07 21:04:44 +02:00
Friedrich Lindenberg
61b33d9d4f Use sha1 to generate index IDs. 2015-06-11 11:54:04 +02:00
Friedrich Lindenberg
0c04f647b2 re-introduce relative imports to unbork python 3. 2015-06-08 10:54:46 +02:00
Friedrich Lindenberg
56d5b232d8 Include support for custom result row types, fixes #41. 2015-05-23 16:15:17 +02:00
Friedrich Lindenberg
7f7cb41858 Handle column name validation more coherently, fixes #45. 2015-05-23 15:30:19 +02:00
Friedrich Lindenberg
fd3d9f326c Cannot recall why this is using NullPool, hence removing to fix #65. 2015-05-23 15:15:00 +02:00
Friedrich Lindenberg
a0eab8876e Remove space. 2015-05-23 13:41:08 +02:00
Friedrich Lindenberg
819c37d61d Make __getitem__ an alias for distinct(). Fixes #87. 2015-05-23 13:01:36 +02:00
Friedrich Lindenberg
5e5d69457e Add a program name to argparse. 2015-05-23 13:01:01 +02:00
Friedrich Lindenberg
43453415c0 wat 2015-05-21 23:47:46 +02:00
Friedrich Lindenberg
537557285d Change signature of .upsert and .update on table according to: fixes #43. 2015-05-21 23:38:14 +02:00
Friedrich Lindenberg
edef86126f Connect to an in-memory sqlite if no database is specified. 2015-05-21 23:37:37 +02:00
Friedrich Lindenberg
19cc76dd60 Don’t allow dots in column names, fixes #86. 2015-05-21 23:21:47 +02:00
Friedrich Lindenberg
a95c7be33b pass schema into table constructors. 2015-05-21 22:07:03 +02:00
Friedrich Lindenberg
e662d8bde7 Support for properly returning a query count. 2015-05-21 18:05:26 +02:00
Friedrich Lindenberg
5dad532478 Clean up imports. 2015-05-21 17:40:57 +02:00
Friedrich Lindenberg
3afcfb3b81 Introduce some sanity checking on table names, fixes #89. 2015-05-21 17:38:06 +02:00
Friedrich Lindenberg
e9aec72bac Slurp result proxy in one go so the query doesn’t remain open. Fixes #15. 2015-05-21 17:17:14 +02:00
Friedrich Lindenberg
9361c8ef9d Remove datetime fix code. 2015-05-21 16:52:15 +02:00
Friedrich Lindenberg
55c33cbc71 Remove now-invalid import. 2015-05-21 16:52:03 +02:00
Friedrich Lindenberg
c605841390 Switch to normality for slugs 2015-05-21 16:51:57 +02:00
Friedrich Lindenberg
01f85c11b9 Rename reflectMetadata to reflect_metadata, remove SQLite datetime fix. 2015-05-21 16:48:28 +02:00
Friedrich Lindenberg
d3473fc4a6 Include tests from PR, fixes #105. 2015-05-21 16:47:36 +02:00
Simon Conseil
24e53b6807 Make Travis happy. 2015-02-18 16:48:46 +01:00
Simon Conseil
d5a419cbe0 Reflect views.
Currently views does not appear in the list of tables, this allows to add views.
2015-02-18 16:47:10 +01:00
Friedrich Lindenberg
e5c1aa31b4 handle date.isoformat separately, refs #117 2015-01-23 13:14:08 +01:00
Friedrich Lindenberg
bdcd371b5a Convert plain text queries to SQL to allow argument escaping.
Bump 0.5.6, refs #115.
2015-01-18 13:39:30 +01:00
Friedrich Lindenberg
18bd02419a better comment 2015-01-18 10:53:58 +01:00
Alexei
7bec815714 Document insert()'s return. 2015-01-07 09:06:34 -05:00
Stefan Wehrmeyer
79d2145202 Make find_one behave more like find 2015-01-06 21:44:59 +01:00
xrotwang
d58e3ec691 extended test coverage for the freeze package, thereby fixing some bugs. 2014-11-06 14:09:52 +01:00
xrotwang
5b7908893d make dataset.freeze.config compatible with python3 2014-11-06 11:08:07 +01:00
xrotwang
4bf19159c6 Merge remote-tracking branch 'upstream/master' 2014-11-06 10:13:04 +01:00
aniversarioperu
036739589a Fixing typo in docstring for query
The SQLAlchemy link was pointing to a dead link.
2014-10-05 11:51:18 +03:00
aniversarioperu
1e82be8fd0 fixed code and test for Python3 2014-09-04 07:02:27 +03:00
Thomas Levine
17bad827ae add __contains__ 2014-08-29 18:12:25 +00:00
Chenguang Zhang
a8b2f1ad73 Add more instructions for engine_kwargs, to avoid DB connection timeout issues 2014-08-07 16:47:50 +08:00
Tyler Kennedy
91c985b3e8 Update database.py
Inverted logic means _release_internal will always fail on a rollback. Fixed and simplified.
2014-07-31 11:07:09 -04:00
xrotwang
0b76c3fadb fixed problems reported by flake8 2014-07-25 12:46:55 +02:00
xrotwang
a14f0bbde2 ported freezing as csv to python 3.4 2014-07-25 12:15:08 +02:00
Victor Kashirin
38b1114bde Add support for with statement 2014-06-09 01:36:42 +04:00
Friedrich Lindenberg
f5535fa085 Handle NULL dates, fixes #91. 2014-05-14 14:39:13 +02:00
Friedrich Lindenberg
fcbaf977c0 Fix flake. 2014-05-12 19:44:15 +02:00
Friedrich Lindenberg
d56b767479 Implement support for handling file objects as
input to the freeze function, fixes #79.
2014-05-12 19:35:44 +02:00
Friedrich Lindenberg
9c32d18607 fix flake8 errors 2014-04-20 14:07:13 +02:00
John Lee
798e92e472 Fix find order_by bug for descending order 2014-03-07 17:07:38 -08:00
Friedrich Lindenberg
e7d317b38b Flakes are gone 2014-02-18 13:08:06 +01:00
Friedrich Lindenberg
5e90421e2d Fix Python3 support 2014-02-18 13:03:19 +01:00
Friedrich Lindenberg
6ef4cd7814 Revert to using OrderedDict. 2014-02-18 12:59:12 +01:00
Stefan Wehrmeyer
ea31943e18 Fix too early StopIteration on empty result sets
Fixes #77, thanks to @hfaran for report
2014-02-16 13:48:56 +01:00
Friedrich Lindenberg
a797e90357 Don't try to execute DDL in a transactional context. 2014-02-12 13:52:59 +01:00
Chen Liu
03cb294e34 fix rows to rows.rowcount 2014-02-04 09:23:49 +01:00
Chen Liu
5b162feea7 add __repr__ method to Table 2014-02-04 09:23:42 +01:00
Chen Liu
682b90cb6e let table.delete return true/false 2014-02-04 09:23:34 +01:00
Stefan Wehrmeyer
77025cede2 Accept engine_kwargs kwarg in connect call 2014-01-31 22:21:24 +01:00
Stefan Wehrmeyer
cd1d3a1d67 Remove documentation on old __getattr__ API 2014-01-31 22:10:17 +01:00
Stefan Wehrmeyer
3fd1c1185a Pass in create_engine kwargs through database constructor 2014-01-31 22:03:34 +01:00
Stefan Wehrmeyer
ed007bf4be Reduce default String length of pk to 255 2014-01-31 21:11:12 +01:00
Stefan Wehrmeyer
5f2c0193b8 Make print a function in documentation 2014-01-31 20:42:26 +01:00
Stefan Wehrmeyer
8f4cd59c9a Treat columns as ordered throughout code
The set() does not make anything any easier,
lists are closer to underlying representation.
2014-01-31 20:42:04 +01:00
Stefan Wehrmeyer
0e39190062 Reduce complexity of __getitem__ API
If you need to specify more, call get_table method
2014-01-31 19:18:58 +01:00
Grzegorz Niewisiewicz
a4d676f325 Merge branch 'master' into fix-table-cache 2014-01-27 08:56:28 +01:00
Stefan Wehrmeyer
92817d5f4d Make flake8 part of test suite 2014-01-25 21:45:30 +01:00
Stefan Wehrmeyer
0726dd9cf3 Remove OrderedDict implementation as RowProxy is returned
http://docs.sqlalchemy.org/en/rel_0_9/core/connections.html?highlight=rowproxy#sqlalchemy.engine.RowProxy
2014-01-25 21:22:11 +01:00
Stefan Wehrmeyer
eff6925af9 Fix infinite loop in find method
If a _limit is not given, the query limit should
be given by eit
2014-01-25 21:20:18 +01:00
Stefan Wehrmeyer
5a7cafd4e2 Don't convert to datetime, if it is already datetime 2014-01-25 21:06:38 +01:00
Grzegorz Niewisiewicz
d07cc90345 Update the table cache in update_table (fixes 67)
The problem occurs in the following scenario:

* an instance of a Table, obtained through Database.get_table, is used
  to insert some data
* a different instance of Table, obtained through Database.get_table
  call after the data has been inserted, uses a Table instance that is
  not up-to-date

The result is that, e.g. the keys created with the first Table object
aren't accessible via the second object.

This fixes the problem by updating the table cache in
Database.update_table.
2014-01-17 14:54:46 +01:00
Aditya Upadhyay
6d5e1c755f fixed bug with offsets and limits. 2014-01-12 23:56:14 +05:30
Friedrich Lindenberg
382703f753 Merge pull request #46 from 3onyc/issue-34
Implement SQLite datetime fix (Fixes #34)
2014-01-05 09:39:48 -08:00
Friedrich Lindenberg
3abe9d2c8d Merge branch 'python-3' of github.com:stefanw/dataset into stefanw-python-3 2014-01-05 17:52:59 +01:00