Skip to content

Commit

Permalink
Fix local table creation failing
Browse files Browse the repository at this point in the history
  • Loading branch information
christoph-blessing committed Sep 29, 2023
1 parent 56d03b7 commit e162562
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion link/infrastructure/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ def create_table_definition_provider(table: Callable[[], dj.Table]) -> Callable[
"""Create an object that provides the definition of the table produced by the given factory when called."""

def provide_definition() -> str:
return table().describe(printout=False)
return str(table().heading)

return provide_definition
30 changes: 30 additions & 0 deletions tests/functional/test_creation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import datajoint as dj

from link import link


def test_local_table_creation_from_source_table_that_has_parent_raises_no_error(
prepare_link, create_table, prepare_table, databases, configured_environment, connection_config
):
schema_names, user_specs = prepare_link()
source_table_parent = create_table("Foo", dj.Manual, "foo: int")
prepare_table(databases["source"], user_specs["source"], schema_names["source"], source_table_parent)
source_table_name = "Bar"
source_table = create_table(source_table_name, dj.Manual, "-> source_table_parent")
prepare_table(
databases["source"],
user_specs["source"],
schema_names["source"],
source_table,
context={"source_table_parent": source_table_parent},
)
with connection_config(databases["local"], user_specs["local"]), configured_environment(
user_specs["link"], schema_names["outbound"]
):
link(
databases["source"].container.name,
schema_names["source"],
schema_names["outbound"],
"Outbound",
schema_names["local"],
)(type(source_table_name, (dj.Manual,), {}))

0 comments on commit e162562

Please sign in to comment.