Skip to content

Instantly share code, notes, and snippets.

@nickstenning
Created April 19, 2017 13:18
Show Gist options
  • Save nickstenning/62bce259c77cd71cb0389e297dff9488 to your computer and use it in GitHub Desktop.
Save nickstenning/62bce259c77cd71cb0389e297dff9488 to your computer and use it in GitHub Desktop.
id = sa.Column(types.URLSafeUUID, server_default=sa.func.uuid_generate_v1mc(), primary_key=True)
references = sa.Column(pg.ARRAY(types.URLSafeUUID, zero_indexes=True))
thread_root_id = column_property(references[0])
thread_root = sa.orm.relationship('Annotation', primaryjoin=remote(id) == foreign(thread_root_id), uselist=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment