Skip to content
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
bcfb173
attachments are saved as intact files
dimitri-yatsenko Sep 13, 2019
18366e6
reform attachments and filepath
dimitri-yatsenko Sep 13, 2019
11d7d9b
complete implementation of external storage except for `clean`
dimitri-yatsenko Sep 16, 2019
22347ae
Merge branch 'dev' of https://github.com/datajoint/datajoint-python i…
dimitri-yatsenko Sep 16, 2019
7e7c183
refactor external storage
dimitri-yatsenko Sep 18, 2019
8aa1543
complete refactoring of external storage for version 0.12
dimitri-yatsenko Sep 20, 2019
a2d6f9a
rename attribute `basename` to `attachment_name` in external table
dimitri-yatsenko Sep 20, 2019
2c11a65
add __repr__ to ExternalMapping
dimitri-yatsenko Sep 20, 2019
3a1c6ab
external files are not copied if stage and store are the same
dimitri-yatsenko Sep 20, 2019
478b36a
make external tables require setting the `delete_external_files` argu…
dimitri-yatsenko Sep 20, 2019
bb1deab
update CHANGELOG
dimitri-yatsenko Sep 23, 2019
e2636ed
fix Python 3.4 compatibility
dimitri-yatsenko Sep 23, 2019
11a1f93
fix Python 3.4 and 3.5 compatibility
dimitri-yatsenko Sep 23, 2019
165f795
dropped support for Python 3.4
dimitri-yatsenko Sep 23, 2019
c18af74
Merge branch 'dev' of https://github.com/datajoint/datajoint-python i…
dimitri-yatsenko Sep 26, 2019
48147f1
minor changes in error messages
dimitri-yatsenko Oct 1, 2019
2e26c4a
Merge branch 'dev' of https://github.com/datajoint/datajoint-python i…
dimitri-yatsenko Oct 3, 2019
0c4fd1c
Update to pathlib in test init.
guzman-raphael Oct 3, 2019
6ba86e0
Update test_blob_migrate to be compatible for WIN10.
guzman-raphael Oct 3, 2019
43a5126
Fix WIN10 compatibility with KeyboardInterrupt and SystemExit excepti…
guzman-raphael Oct 3, 2019
c7ca34c
Merge pull request #4 from guzman-raphael/dimitri-attach
dimitri-yatsenko Oct 3, 2019
5c99e37
Fix WIN10 filepath to store as posix and fetch as user's platform.
guzman-raphael Oct 4, 2019
e2c3f23
Fix relpath for Python3.5.
guzman-raphael Oct 4, 2019
93aeefc
Fix copytree for Python3.5.
guzman-raphael Oct 4, 2019
20719ae
Fix typo.
guzman-raphael Oct 4, 2019
7ca0099
Fix for Python3.5.
guzman-raphael Oct 4, 2019
f3ffd63
Update coveralls.
guzman-raphael Oct 4, 2019
bb1b40f
Update coverall env vars.
guzman-raphael Oct 4, 2019
f05c50d
Merge pull request #5 from guzman-raphael/win-filepath
dimitri-yatsenko Oct 5, 2019
298efed
add environment variable DJ_SUPPORT_FILEPATH_MANAGEMENT to enable/dis…
dimitri-yatsenko Oct 7, 2019
e609fbe
Merge branch 'attach' of https://github.com/dimitri-yatsenko/datajoin…
dimitri-yatsenko Oct 7, 2019
6dda528
Update CHANGELOG.md
dimitri-yatsenko Oct 8, 2019
796dae6
Update CHANGELOG.md
dimitri-yatsenko Oct 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .coveralls.yml

This file was deleted.

8 changes: 2 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ env:
- COMPOSE_HTTP_TIMEOUT="300"
- UID="2000"
- GID="2000"
- COVERALLS_SERVICE_NAME="travis-ci"
- COVERALLS_REPO_TOKEN="fd0BoXG46TPReEem0uMy7BJO5j0w1MQiY"
services:
- docker
main: &main
Expand Down Expand Up @@ -64,9 +66,3 @@ jobs:
env:
- PY_VER: "3.5"
- MYSQL_VER: "5.6"
- stage: Coverage
os: linux
language: shell
script:
- sudo pip install python-coveralls
- coveralls
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
## Release notes

### 0.12.0 -- October 1, 2019
* Dropped support for Python 3.4
* Support secure connections with TLS (aka SSL) PR #620
* Convert numpy array from python object to appropriate data type if all elements are of the same type (#587) PR #608
* Remove expression requirement to have additional attributes (#604) PR #604
* Support for filepath datatype (#481) PR #603
* Avoid creating multiple copies of attachments and return a dictionary array when specifying `as_dict=True` (#592, #595) PR #593
* Support for filepath datatype (#481) PR #603, #659
* Support file attachment datatype (#480, #592, #637, PR #659)
* Fetch return a dict array when specifying `as_dict=True` for specified attributes. (#595) PR #593
* Support of ellipsis in `proj`: `query_expression.proj(.., '-movie')` (#499) PR #578
* Expand support of blob serialization (#572, #520, #427, #392, #244, #594) PR #577
* Support for alter (#110) PR #573
Expand All @@ -16,10 +18,12 @@
* `dj.ERD` is now called `dj.Diagram` (#255, #546) PR #565
* `dj.Diagram` underlines "distinguished" classes (#378) PR #557
* Accept alias for supported MySQL datatypes (#544) PR #545
* Support for pandas and order by "KEY" (#459, #537, #538, #541) PR #534
* Support file attachment datatype and configurable blob storage (#467, #475, #480, #497) PR #532
* Support for pandas in `fetch` (#459, #537) PR #534
* Support for ordering by "KEY" in `fetch` (#541) PR #534
* Improved external storage - a migration script needed from version 0.11 (#467, #475, #480, #497) PR #532
* Increase default display rows (#523) PR #526
* Bugfixes (#521, #205, #279, #477, #570, #581, #597, #596, #618, #633, #643, #644, #647, #656)
* Minor improvements (#538)

### 0.11.3 -- Jul 26, 2019
* Fix incompatibility with pyparsing 2.4.1 (#629) PR #631
Expand Down
5 changes: 4 additions & 1 deletion LNX-docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ services:
- PYTHON_USER=dja
- JUPYTER_PASSWORD=datajoint
- DISPLAY
- COVERALLS_SERVICE_NAME
- COVERALLS_REPO_TOKEN
working_dir: /src
command: >
/bin/sh -c
"
pip install --user nose nose-cov .;
pip install --user nose nose-cov coveralls .;
pip freeze | grep datajoint;
nosetests -vsw tests --with-coverage --cover-package=datajoint;
coveralls;
# jupyter notebook;
"
# ports:
Expand Down
28 changes: 0 additions & 28 deletions datajoint/attach.py

This file was deleted.

23 changes: 1 addition & 22 deletions datajoint/attribute_adapter.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
import re
import os
from .errors import DataJointError


ADAPTED_TYPE_SWITCH = "DJ_SUPPORT_ADAPTED_TYPES"


def _switch_adapated_types(on):
"""
Enable (on=True) or disable (on=False) support for AttributeAdapter
"""
if on:
os.environ[ADAPTED_TYPE_SWITCH] = "TRUE"
else:
del os.environ[ADAPTED_TYPE_SWITCH]


def _support_adapted_types():
"""
check if support for AttributeAdapter is enabled
"""
return os.getenv(ADAPTED_TYPE_SWITCH, "FALSE").upper() == "TRUE"
from .errors import DataJointError, _support_adapted_types


class AttributeAdapter:
Expand Down
3 changes: 1 addition & 2 deletions datajoint/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def translate_query_error(client_error, query):
return errors.MissingTableError(client_error.args[1], query)
if isinstance(client_error, client.err.InternalError) and client_error.args[0] == 1364:
return errors.MissingAttributeError(*client_error.args[1:])
raise client_error


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -187,7 +186,7 @@ def __execute_query(cursor, query, args, cursor_class, suppress_warnings):
warnings.simplefilter("ignore")
cursor.execute(query, args)
except client_errors as err:
raise translate_query_error(err, query)
raise translate_query_error(err, query) from None

def query(self, query, args=(), *, as_dict=False, suppress_warnings=True, reconnect=None):
"""
Expand Down
8 changes: 7 additions & 1 deletion datajoint/declare.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import re
import pyparsing as pp
import logging
from .errors import DataJointError
from .errors import DataJointError, _support_filepath_types, FILEPATH_FEATURE_SWITCH
from .attribute_adapter import get_adapter

from .utils import OrderedDict
Expand Down Expand Up @@ -395,6 +395,12 @@ def substitute_special_type(match, category, foreign_key_sql, context):
elif category == 'INTERNAL_ATTACH':
match['type'] = 'LONGBLOB'
elif category in EXTERNAL_TYPES:
if category == 'FILEPATH' and not _support_filepath_types():
raise DataJointError("""
The filepath data type is disabled until complete validation.
To turn it on as experimental feature, set the environment variable
{env} = TRUE or upgrade datajoint.
""".format(env=FILEPATH_FEATURE_SWITCH))
match['store'] = match['type'].split('@', 1)[1]
match['type'] = UUID_DATA_TYPE
foreign_key_sql.append(
Expand Down
42 changes: 42 additions & 0 deletions datajoint/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Exception classes for the DataJoint library
"""

import os


# --- Top Level ---
class DataJointError(Exception):
Expand Down Expand Up @@ -77,3 +79,43 @@ class MissingExternalFile(DataJointError):
"""
Error raised when an external file managed by DataJoint is no longer accessible
"""


# environment variables to control availability of experimental features

ADAPTED_TYPE_SWITCH = "DJ_SUPPORT_ADAPTED_TYPES"
FILEPATH_FEATURE_SWITCH = "DJ_SUPPORT_FILEPATH_MANAGEMENT"


def _switch_adapted_types(on):
"""
Enable (on=True) or disable (on=False) support for AttributeAdapter
"""
if on:
os.environ[ADAPTED_TYPE_SWITCH] = "TRUE"
else:
del os.environ[ADAPTED_TYPE_SWITCH]


def _support_adapted_types():
"""
check if support for AttributeAdapter is enabled
"""
return os.getenv(ADAPTED_TYPE_SWITCH, "FALSE").upper() == "TRUE"


def _switch_filepath_types(on):
"""
Enable (on=True) or disable (on=False) support for AttributeAdapter
"""
if on:
os.environ[FILEPATH_FEATURE_SWITCH] = "TRUE"
else:
del os.environ[FILEPATH_FEATURE_SWITCH]


def _support_filepath_types():
"""
check if support for AttributeAdapter is enabled
"""
return os.getenv(FILEPATH_FEATURE_SWITCH, "FALSE").upper() == "TRUE"
Loading