Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Allow external storage as file to store at root.
  • Loading branch information
guzman-raphael committed Nov 8, 2019
commit f21aa041d7062d371f8598bbe9998c56aaf3e9dd
17 changes: 11 additions & 6 deletions datajoint/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,17 @@ def s3(self):

def _make_external_filepath(self, relative_filepath):
"""resolve the complete external path based on the relative path"""
posix_path = PurePosixPath(PureWindowsPath(self.spec['location']))
location_path = Path(
*posix_path.parts[1:]) if any(
case in posix_path.parts[0] for case in (
'\\', ':')) else Path(posix_path)
return PurePosixPath(location_path, relative_filepath)
if self.spec['protocol'] == 's3':
posix_path = PurePosixPath(PureWindowsPath(self.spec['location']))
location_path = Path(
*posix_path.parts[1:]) if any(
case in posix_path.parts[0] for case in (
'\\', ':')) else Path(posix_path)
return PurePosixPath(location_path, relative_filepath)
elif self.spec['protocol'] == 'file':
return PurePosixPath(Path(self.spec['location']), relative_filepath)
else:
assert False

def _make_uuid_path(self, uuid, suffix=''):
"""create external path based on the uuid hash"""
Expand Down
1 change: 1 addition & 0 deletions tests/test_blob_migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from . import S3_CONN_INFO
from . import CONN_INFO
from datajoint.migrate import _migrate_dj011_blob
dj.config['enable_python_native_blobs'] = True


class TestBlobMigrate:
Expand Down