Skip to content

Commit e1f24c5

Browse files
Merge pull request #858 from guzman-raphael/plugin_merge
Pull in plugin feature and merge from `master`
2 parents 304295e + 0525a78 commit e1f24c5

39 files changed

+633
-251
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'bug, awaiting-triage'
6+
assignees: ''
7+
8+
---
9+
10+
## Bug Report
11+
12+
### Description
13+
A clear and concise description of what is the overall operation that is intended to be performed that resulted in an error.
14+
15+
### Reproducibility
16+
Include:
17+
- OS (WIN | MACOS | Linux)
18+
- Python Version OR MATLAB Version
19+
- MySQL Version
20+
- MySQL Deployment Strategy (local-native | local-docker | remote)
21+
- DataJoint Version
22+
- Minimum number of steps to reliably reproduce the issue
23+
- Complete error stack as a result of evaluating the above steps
24+
25+
### Expected Behavior
26+
A clear and concise description of what you expected to happen.
27+
28+
### Screenshots
29+
If applicable, add screenshots to help explain your problem.
30+
31+
### Additional Research and Context
32+
Add any additional research or context that was conducted in creating this report.
33+
34+
For example:
35+
- Related GitHub issues and PR's either within this repository or in other relevant repositories.
36+
- Specific links to specific lines or a focus within source code.
37+
- Relevant summary of Maintainers development meetings, milestones, projects, etc.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for a new feature
4+
title: ''
5+
labels: 'enhancement, awaiting-triage'
6+
assignees: ''
7+
8+
---
9+
10+
## Feature Request
11+
12+
### Problem
13+
A clear and concise description how this idea has manifested and the context. Elaborate on the need for this feature and/or what could be improved. Ex. I'm always frustrated when [...]
14+
15+
### Requirements
16+
A clear and concise description of the requirements to satisfy the new feature. Detail what you expect from a successful implementation of the feature. Ex. When using this feature, it should [...]
17+
18+
### Justification
19+
Provide the key benefits in making this a supported feature. Ex. Adding support for this feature would ensure [...]
20+
21+
### Alternative Considerations
22+
Do you currently have a work-around for this? Provide any alternative solutions or features you've considered.
23+
24+
### Related Errors
25+
Add any errors as a direct result of not exposing this feature.
26+
27+
Please include steps to reproduce provided errors as follows:
28+
- OS (WIN | MACOS | Linux)
29+
- Python Version OR MATLAB Version
30+
- MySQL Version
31+
- MySQL Deployment Strategy (local-native | local-docker | remote)
32+
- DataJoint Version
33+
- Minimum number of steps to reliably reproduce the issue
34+
- Complete error stack as a result of evaluating the above steps
35+
36+
### Screenshots
37+
If applicable, add screenshots to help explain your feature.
38+
39+
### Additional Research and Context
40+
Add any additional research or context that was conducted in creating this feature request.
41+
42+
For example:
43+
- Related GitHub issues and PR's either within this repository or in other relevant repositories.
44+
- Specific links to specific line or focus within source code.
45+
- Relevant summary of Maintainers development meetings, milestones, projects, etc.
46+
- Any additional supplemental web references or links that would further justify this feature request.

.github/workflows/development.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Development
2+
on:
3+
push:
4+
branches:
5+
- '**' # every branch
6+
- '!stage*' # exclude branches beginning with stage
7+
pull_request:
8+
branches:
9+
- '**' # every branch
10+
- '!stage*' # exclude branches beginning with stage
11+
jobs:
12+
test:
13+
if: github.event_name == 'push' || github.event_name == 'pull_request'
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
py_ver: ["3.8"]
18+
mysql_ver: ["8.0", "5.7", "5.6"]
19+
include:
20+
- py_ver: "3.7"
21+
mysql_ver: "5.7"
22+
- py_ver: "3.6"
23+
mysql_ver: "5.7"
24+
- py_ver: "3.5"
25+
mysql_ver: "5.7"
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Set up Python ${{matrix.py_ver}}
29+
uses: actions/setup-python@v2
30+
with:
31+
python-version: ${{matrix.py_ver}}
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install flake8
36+
- name: Run syntax tests
37+
run: flake8 datajoint --count --select=E9,F63,F7,F82 --show-source --statistics
38+
- name: Run primary tests
39+
env:
40+
UID: "1001"
41+
GID: "116"
42+
PY_VER: ${{matrix.py_ver}}
43+
MYSQL_VER: ${{matrix.mysql_ver}}
44+
ALPINE_VER: "3.10"
45+
MINIO_VER: RELEASE.2019-09-26T19-42-35Z
46+
COMPOSE_HTTP_TIMEOUT: "120"
47+
COVERALLS_SERVICE_NAME: travis-ci
48+
COVERALLS_REPO_TOKEN: fd0BoXG46TPReEem0uMy7BJO5j0w1MQiY
49+
run: docker-compose -f LNX-docker-compose.yml up --build --exit-code-from app
50+
- name: Run style tests
51+
run: |
52+
flake8 --ignore=E121,E123,E126,E226,E24,E704,W503,W504,E722,F401,W605 datajoint \
53+
--count --max-complexity=62 --max-line-length=127 --statistics

.travis.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
## Release notes
22

3+
### 0.13.0 -- TBD
4+
* Support DataJoint datatype and connection plugins (#715, #729) PR 730, #735
5+
* Allow updating specified secondary attributes using `update1` PR #763
6+
7+
### 0.12.8 -- Jan 12, 2021
8+
* table.children, .parents, .descendents, and ancestors can return queryable objects. PR #833
9+
* Load dependencies before querying dependencies. (#179) PR #833
10+
* Fix display of part tables in `schema.save`. (#821) PR #833
11+
* Add `schema.list_tables`. (#838) PR #844
12+
* Fix minio new version regression. PR #847
13+
* Add more S3 logging for debugging. (#831) PR #832
14+
* Convert testing framework from TravisCI to GitHub Actions (#841) PR #840
15+
316
### 0.12.7 -- Oct 27, 2020
417
* Fix case sensitivity issues to adapt to MySQL 8+. PR #819
518
* Fix pymysql regression bug (#814) PR #816

LNX-docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ services:
3232
interval: 1s
3333
fakeservices.datajoint.io:
3434
<<: *net
35-
image: raphaelguzman/nginx:v0.0.10
35+
image: raphaelguzman/nginx:v0.0.13
3636
environment:
3737
- ADD_db_TYPE=DATABASE
3838
- ADD_db_ENDPOINT=db:3306

datajoint.pub

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-----BEGIN PUBLIC KEY-----
2+
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDUMOo2U7YQ1uOrKU/IreM3AQP2
3+
AXJC3au+S9W+dilxHcJ3e98bRVqrFeOofcGeRPoNc38fiLmLDUiBskJeVrpm29Wo
4+
AkH6yhZWk1o8NvGMhK4DLsJYlsH6tZuOx9NITKzJuOOH6X1I5Ucs7NOSKnmu7g5g
5+
WTT5kCgF5QAe5JN8WQIDAQAB
6+
-----END PUBLIC KEY-----

datajoint/attribute_adapter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import re
22
from .errors import DataJointError, _support_adapted_types
3+
from .plugin import type_plugins
34

45

56
class AttributeAdapter:
@@ -38,10 +39,11 @@ def get_adapter(context, adapter_name):
3839
raise DataJointError('Support for Adapted Attribute types is disabled.')
3940
adapter_name = adapter_name.lstrip('<').rstrip('>')
4041
try:
41-
adapter = context[adapter_name]
42+
adapter = (context[adapter_name] if adapter_name in context
43+
else type_plugins[adapter_name]['object'].load())
4244
except KeyError:
4345
raise DataJointError(
44-
"Attribute adapter '{adapter_name}' is not defined.".format(adapter_name=adapter_name)) from None
46+
"Attribute adapter '{adapter_name}' is not defined.".format(adapter_name=adapter_name))
4547
if not isinstance(adapter, AttributeAdapter):
4648
raise DataJointError(
4749
"Attribute adapter '{adapter_name}' must be an instance of datajoint.AttributeAdapter".format(

datajoint/autopopulate.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,19 @@ def key_source(self):
3232
The default value is the join of the parent relations.
3333
Users may override to change the granularity or the scope of populate() calls.
3434
"""
35-
def parent_gen(self):
36-
if self.target.full_table_name not in self.connection.dependencies:
37-
self.connection.dependencies.load()
38-
for parent_name, fk_props in self.target.parents(primary=True).items():
39-
if not parent_name.isdigit(): # simple foreign key
40-
yield FreeTable(self.connection, parent_name).proj()
41-
else:
42-
grandparent = list(self.connection.dependencies.in_edges(parent_name))[0][0]
43-
yield FreeTable(self.connection, grandparent).proj(**{
44-
attr: ref for attr, ref in fk_props['attr_map'].items() if ref != attr})
35+
def _rename_attributes(table, props):
36+
return (table.proj(
37+
**{attr: ref for attr, ref in props['attr_map'].items() if attr != ref})
38+
if props['aliased'] else table)
4539

4640
if self._key_source is None:
47-
parents = parent_gen(self)
48-
try:
49-
self._key_source = next(parents)
50-
except StopIteration:
51-
raise DataJointError('A relation must have primary dependencies for auto-populate to work') from None
52-
for q in parents:
53-
self._key_source *= q
41+
parents = self.target.parents(primary=True, as_objects=True, foreign_key_info=True)
42+
if not parents:
43+
raise DataJointError(
44+
'A relation must have primary dependencies for auto-populate to work')
45+
self._key_source = _rename_attributes(*parents[0])
46+
for q in parents[1:]:
47+
self._key_source *= _rename_attributes(*q)
5448
return self._key_source
5549

5650
def make(self, key):

0 commit comments

Comments
 (0)