Skip to content

Commit

Permalink
Version bump. The relationship_parameter_value_list method now return…
Browse files Browse the repository at this point in the history
…s also the relationship id
  • Loading branch information
Manuel Marin committed Nov 26, 2018
1 parent af7012f commit 75ddcae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions spinedatabase_api/diff_database_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ def __init__(self, db_url, username=None, create_all=True, warm_up=False):
diff_commit = self.DiffCommit(comment=comment, date=date, user=user)
self.session.add(diff_commit)

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
self.close()

def has_pending_changes(self):
"""Return True if there are uncommitted changes. Otherwise return False."""
if any([v for v in self.new_item_id.values()]):
Expand Down Expand Up @@ -669,6 +663,7 @@ def relationship_parameter_value_list(self, relationship_class_id=None, paramete
wide_relationship_class_list.c.name.label('relationship_class_name'),
wide_relationship_class_list.c.object_class_id_list,
wide_relationship_class_list.c.object_class_name_list,
wide_relationship_list.c.id.label('relationship_id'),
wide_relationship_list.c.object_id_list,
wide_relationship_list.c.object_name_list,
parameter_list.c.id.label('parameter_id'),
Expand All @@ -690,6 +685,7 @@ def relationship_parameter_value_list(self, relationship_class_id=None, paramete
wide_relationship_class_list.c.name.label('relationship_class_name'),
wide_relationship_class_list.c.object_class_id_list,
wide_relationship_class_list.c.object_class_name_list,
wide_relationship_list.c.id.label('relationship_id'),
wide_relationship_list.c.object_id_list,
wide_relationship_list.c.object_name_list,
parameter_list.c.id.label('parameter_id'),
Expand Down Expand Up @@ -967,6 +963,8 @@ def check_wide_relationship(self, wide_kwargs, relationship_list, relationship_c
raise SpineIntegrityError("Object not found.")
if given_object_class_id_list != object_class_id_list:
raise SpineIntegrityError("Incorrect objects for this relationship class.")
if len(object_id_list) != len(set(object_id_list)):
raise SpineIntegrityError("The same object can't appear twice in one relationship.")
if (class_id, object_id_list) in [(x["class_id"], x["object_id_list"]) for x in relationship_list]:
raise SpineIntegrityError("There can't be more than one relationship between the same objects "
"in one class.")
Expand Down
2 changes: 1 addition & 1 deletion spinedatabase_api/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.11"
__version__ = "0.0.12"

0 comments on commit 75ddcae

Please sign in to comment.