-
Notifications
You must be signed in to change notification settings - Fork 19
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
document suite run database schema #28
Comments
Something from the
|
Note that I'm now writing a bunch of suite-performance reporting scripts which slightly rely on what the database schema is like, so it would be even cooler if it was documented. They can be redone pretty easily however. |
I guess we should begin by adding more docs in the code where the schema is defined: I'll work on as soon as I have a chance. |
Would you accept a PR if I added some docs for just the things I rely on?
… On 18 Apr 2018, at 08:51, Matt Shin ***@***.***> wrote:
I guess we should begin by adding more docs in the code where the schema is defined:
https://github.com/cylc/cylc/blob/master/lib/cylc/rundb.py
I'll work on as soon as I have a chance.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@tfeb Please feel free to raise PRs. |
The proposed adoption of the Sphinx documentation engine opens up the possibility for auto-documentation in many areas. Shall we supersede this issue with #2651? |
I was doing the reverse engineer with the IDE when I wanted to pick at the class <-> db relationship, but not sure how precise it is. Definitely interested in seeing this one done (and keen to help testing/reviewing). |
Posted on Riot.im, but added a post-it (going through all my pending post-its today 🎉 ) to add the script and link here. #FOR: https://github.com/cylc/cylc/issues/2483
#!/usr/bin/env python3
# coding=utf-8
import sys
import tempfile
# hack until setup.py is done and we are installing it via pip/setuptools
sys.path.append("/home/kinow/Development/python/workspace/cylc/lib/")
from eralchemy import render_er
from cylc.rundb import CylcSuiteDAO
def main():
"""Create cylc public database, then run diagram creation tool."""
with tempfile.NamedTemporaryFile() as tf:
# is_public=False triggers the creation of tables
CylcSuiteDAO(db_file_name=tf.name, is_public=False)
db_name = "sqlite:///{}".format(tf.name)
render_er(db_name, "cylc-database.png")
if __name__ == '__main__':
main() And a sphinx plugin that does the same without the need for this script (but I have not tested it yet): https://github.com/sphinx-contrib/sqlalchemyviz The main obstacle right now for this are the database constraints, which are missing in the DB schema. Adding them should be easy, but there is a small risk of causing performance issues as sqlite will do some constraint checking when editing data. Here's what it looks like at the moment: |
(Interesting, because I thought most of the tables should have some primary keys.) |
Sorry, should have mentioned it is actually the foreign key constraints that are missing. You are correct, primary keys should be there all right. |
Yes, I guess we can add some foreign keys between tables - mostly for mapping task names and cycle points. |
Would be good, even just for the purposes of standardisation. |
Now that we are seeing more usage of the suite run database, we should document the schema in CUG.
See also #864, #1032.
The text was updated successfully, but these errors were encountered: