From 5bbc1e9d50f7bfef47301e18be007b645605c3d3 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Sun, 9 Jan 2022 20:13:25 -0600 Subject: [PATCH 1/2] project out secondary attributes from key_source tables before joining them --- datajoint/autopopulate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datajoint/autopopulate.py b/datajoint/autopopulate.py index c32297028..da2fdf8e4 100644 --- a/datajoint/autopopulate.py +++ b/datajoint/autopopulate.py @@ -26,7 +26,7 @@ class AutoPopulate: @property def key_source(self): """ - :return: the relation whose primary key values are passed, sequentially, to the + :return: the query expression whose primary key values are passed, sequentially, to the ``make`` method when populate() is called. The default value is the join of the parent relations. Users may override to change the granularity or the scope of populate() calls. @@ -34,7 +34,7 @@ def key_source(self): def _rename_attributes(table, props): return (table.proj( **{attr: ref for attr, ref in props['attr_map'].items() if attr != ref}) - if props['aliased'] else table) + if props['aliased'] else table.proj()) if self._key_source is None: parents = self.target.parents(primary=True, as_objects=True, foreign_key_info=True) From 69174c5b561449828f221a581561be1d8188ea40 Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Wed, 19 Jan 2022 10:59:55 -0600 Subject: [PATCH 2/2] minor: improve docstrings --- datajoint/autopopulate.py | 8 ++++---- datajoint/table.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/datajoint/autopopulate.py b/datajoint/autopopulate.py index da2fdf8e4..7802f8288 100644 --- a/datajoint/autopopulate.py +++ b/datajoint/autopopulate.py @@ -26,10 +26,10 @@ class AutoPopulate: @property def key_source(self): """ - :return: the query expression whose primary key values are passed, sequentially, to the - ``make`` method when populate() is called. - The default value is the join of the parent relations. - Users may override to change the granularity or the scope of populate() calls. + :return: the query expression that yields primary key values to be passed, + sequentially, to the ``make`` method when populate() is called. + The default value is the join of the parent relations. + Users may override to change the granularity or the scope of populate() calls. """ def _rename_attributes(table, props): return (table.proj( diff --git a/datajoint/table.py b/datajoint/table.py index bed38a693..20a07c32f 100644 --- a/datajoint/table.py +++ b/datajoint/table.py @@ -55,7 +55,8 @@ class Table(QueryExpression): _table_name = None # must be defined in subclass _log_ = None # placeholder for the Log table object - # These properties must be set by the schema decorator (schemas.py) at class level or by FreeTable at instance level + # These properties must be set by the schema decorator (schemas.py) at class level + # or by FreeTable at instance level database = None declaration_context = None