Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(versioning): Add support for auto data versioning #355

Merged
merged 10 commits into from
May 17, 2021

Conversation

kulgan
Copy link
Contributor

@kulgan kulgan commented Apr 5, 2021

Adds support for tagging nodes based on properties set in the dictionary. Adds the following sysan properties

  • version: version number for the given node
  • tag: a uuid string that represents nodes of same version (ie, all nodes with same tag are versions of each other)
  • latest: True, if the given node is the latest
    These values are evaluated using properties defined in the dictionary (currently only biodictionary defines those properties). The property name is tagProperties. See wiki for more description on how the versioning is expected to work

This PR enables automatically setting these values and querying nodes via these properties.
To get all version 2 nodes one can do this

v2_nodes = g.nodes().sysan(version=2)

to get all nodes with tag = "tag_1"

tagged = g.nodes().sysan(tag="tag_1")

@kulgan kulgan marked this pull request as ready for review April 23, 2021 14:38
psql -U postgres -c "create database automated_test with owner test;"
psql -U postgres -c "create database dev_models with owner test;"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing new line at end-of-line



def __get_tagged_version(node_id, table, tag, conn):
"""Super private function to figure out the proper version number to use just after insertion
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit picking: we might want to add the fact that we also set all existing node with same tag to be _sysan["latest"]=False

create_ng_tables(engine)


def create_ng_tables(engine):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

gdcdatamodel/models/versioning.py Show resolved Hide resolved
Copy link
Contributor

@XukunXiangUChicago XukunXiangUChicago left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kulgan kulgan merged commit b7563d0 into develop May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants