Commit Graph

359 Commits

Author SHA1 Message Date
Friedrich Lindenberg
39385b7e0a Make has_column case insensitive, refs #270. 2020-01-11 14:31:51 +01:00
Friedrich Lindenberg
9b1f8ea649 Simplify 2020-01-11 14:31:07 +01:00
Friedrich Lindenberg
45ae60349c Remove use of six because its 2020 2020-01-11 14:06:57 +01:00
Friedrich Lindenberg
ce28a0d4e8 Pass through column arguments, fixes #233, #266. 2020-01-11 13:55:57 +01:00
Friedrich Lindenberg
e766fa25f0 Fix incorrect query generation, fixes #290. 2020-01-11 13:47:34 +01:00
Friedrich Lindenberg
d7f23933f1 Fix doc error, fixes #297. 2020-01-11 13:36:28 +01:00
Friedrich Lindenberg
d0c4e9fcc7 Implement method to close database connections, fixes #246. 2020-01-11 13:16:30 +01:00
Friedrich Lindenberg
00d2279abf Split _args_to_clause into two functions 2020-01-11 13:02:32 +01:00
Friedrich Lindenberg
bd70c2aa9e
Merge pull request #301 from abmyii/more_find_operators
Implement additional find operators (and relevant tests)
2020-01-11 12:43:29 +01:00
Friedrich Lindenberg
5a09e72fd1 Fix error introduced in #305. 2020-01-11 12:37:50 +01:00
Friedrich Lindenberg
db3ef16566 pep8 2020-01-11 12:11:30 +01:00
Abdurrahmaan Iqbal
e2431bc344 Use lists instead of sets to maintain order of column names 2019-12-24 18:03:35 +00:00
Abdurrahmaan Iqbal
d8cf515ffe Implement additional find operators (and relevant tests) 2019-08-08 12:55:29 +01:00
Friedrich Lindenberg
43e9431865
Merge pull request #296 from conorreid/bigint_check
Add support for BigInteger
2019-07-14 17:58:43 +02:00
conorreid
8409c40645 switch all ints to bigints 2019-07-13 10:42:20 -04:00
Friedrich Lindenberg
081cb5ec7a
Merge pull request #298 from abmyii/master
Implement update_many, upsert_many and refactor for a 2x speed-up of insert_many
2019-07-13 14:47:04 +02:00
Abdurrahmaan Iqbal
19a73759ca Remove f-string for wider compatiblity 2019-07-09 09:50:36 +01:00
Abdurrahmaan Iqbal
6874889591 Fix logic error in insert_many 2019-07-09 09:45:18 +01:00
Abdurrahmaan Iqbal
7fd9241f25 Refactor input_many to remove duplicate code, fix some pep8 problems 2019-07-09 09:37:48 +01:00
Abdurrahmaan Iqbal
76b6165181 Speed up insert_many by sync columns before input, not on the go 2019-07-08 23:24:55 +01:00
Abdurrahmaan Iqbal
85d974b0c3 Refactor to remove duplicate code 2019-07-08 18:00:54 +01:00
Abdurrahmaan Iqbal
70874a2501 Implement update_many and upsert_many 2019-07-08 17:48:05 +01:00
conorreid
7753d0610a bigint check 2019-06-21 11:45:44 -04:00
Andrey Alekseenko
25477717bc Fix bug when UPSERTing a column named 'id' 2019-02-14 22:35:47 -05:00
Friedrich Lindenberg
22b64ee480 Bump version: 1.1.1 → 1.1.2 2019-02-07 10:49:52 +01:00
Friedrich Lindenberg
53e72ef6a8 Bump version: 1.1.0 → 1.1.1 2019-01-31 18:38:30 +01:00
Friedrich Lindenberg
bc1ac231f3 fix actual test failure 2019-01-31 18:22:42 +01:00
Friedrich Lindenberg
8324350f2e Try to fix up tests, Python 3.8 warnings 2019-01-31 14:56:19 +01:00
Friedrich Lindenberg
163e6554cc
Merge pull request #265 from saimn/distinct
Add support for advanced queries in distinct
2018-10-04 16:00:13 +02:00
Simon Conseil
c69827de7c Add support for advanced queries in distinct
Fix #263
2018-09-26 17:36:09 +02:00
Simon Conseil
c36b0f346b Complete table names with IPython 2018-09-26 17:11:08 +02:00
Friedrich Lindenberg
0a2f7c0799
Merge pull request #256 from thelittlebug/dsl-find-feature
add find operators
2018-07-08 11:47:59 -04:00
mwmajewsk
bcd20c7eca
Update util.py - fix ensure_tuple instance check
doing isinstance(obj, Sequence) makes calls with keys of dict impossible
Example:
Returns 
```
d = {'a':'a', 'b':'b'}
table.upsert(values, d.keys())
```
`dict_keys(['a', 'b'])` is not of instance Sequence, but Iterable, therefore `ensure_tuple(dict_keys(['a', 'b']))` returns (dict_keys(['a', 'b']),)
which leads to invalid iteration.
2018-06-20 22:44:49 +02:00
Unknown
45e3ec0037 fix wrong clauses parameter false to sqlalchemy's false() 2018-06-14 07:03:38 +02:00
Unknown
7746e2529b convert unchangeable lists to tuples 2018-06-14 07:01:35 +02:00
Unknown
5829fcc366 remove unused between import 2018-06-13 03:35:24 +02:00
Unknown
f9bb652034 add find operators 2018-06-13 02:29:32 +02:00
Friedrich Lindenberg
38a59b921e Bump version: 1.0.8 → 1.1.0 2018-05-29 22:12:56 +03:00
Friedrich Lindenberg
6d1f42f48c begin using bumpversion. 2018-05-29 22:12:48 +03:00
Friedrich Lindenberg
2b2813c7fe fix lint 2018-05-29 22:05:53 +03:00
Friedrich Lindenberg
881127880a Pad missing columns. Fixes #252. 2018-05-29 21:55:25 +03:00
Paul M Furley
c414f85df9
find(): if table doesn't exist, return an iterator
... rather than []

If a table exists, you can treat the output of `find` as an iterator,
specifically you can call `next(find(...))`:

```
>>> db = dataset.connect('sqlite:///:memory1:')
>>> table = db['table_which_exists']
>>> table.insert({'foo': 'x'})
>>> next(table.find(foo='x'))  # no problem
```

But if the table hasn't been created yet, `find(...)` returns an empty list,
which you can't call `next()` on:

```
>>> db = dataset.connect('sqlite:///:memory2:')
>>> table = db_no_table['table_which_doesnt_exis']
>>> next(table.find(foo='x'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'list' object is not an iterator
```

^^^ rather than a `TypeError`, I'd expect to get a `StopIteration`
exception.
2018-05-29 18:07:32 +01:00
Paul M Furley
a40341abaa
in create_column docs, signpost the Types class 2018-05-17 15:04:30 +01:00
Friedrich Lindenberg
66fd7ce173 make sure all records have the same fields. 2018-04-04 10:43:19 +02:00
Friedrich Lindenberg
9d99ed3e29 Add helper class for chunked inserts. 2018-04-04 09:34:39 +02:00
Friedrich Lindenberg
0d9b2877e2 reflect table again, hoping that helps with sync errors 2018-02-18 10:22:32 +01:00
Friedrich Lindenberg
bce7b31b29 fix #234 2018-01-03 12:22:33 +01:00
Friedrich Lindenberg
2cf9da068a fix flake8 complaints 2017-12-05 17:21:08 +01:00
Friedrich Lindenberg
8226e51408 option for streamed responses. 2017-12-04 23:22:08 +01:00
Friedrich Lindenberg
dbc1edeca9 cleanup imports 2017-10-25 23:06:55 +02:00
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