-
Notifications
You must be signed in to change notification settings - Fork 2.1k
datastore Data Dictionary as postgresql comments #3414
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
Conversation
+1 Keeping the JSON format simple is also a good way to balance usability/i18n, and DB tools like PgAdmin, Toad, Navicat, etc. all will show the comments natively. For the default language, your format is simple enough:
When supporting other languages, will it be something similar to ckanext-fluent?
I intentionally made the JSON just one line. After doing some quick tests with several postgres UI tools, I found that they assumed the comment was on one line... |
I might follow the pattern set out by the |
👍 |
This PR needs tests for the API changes, tests for the controller and a way to display the labels and description fields to users without edit access |
Can confirm it works. Comments show up in postgres tools too like Navicat, psql, Toad, etc! It'd be interesting to see how regular users can see the column info. Should it be implemented as a default Resource View? |
Maybe these fields should be returned from |
Sadly I can't use |
|
||
{% block inner_primary_nav %} | ||
{{ super() }} | ||
{{ h.build_nav_icon('resource_data', _('DataPusher'), id=pkg.name, resource_id=res.id) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see the thinking behind this but from a user perspective I think it makes more sense to display "DataStore", as this is the term that people is more familiar with and what they actually want to work with (ie re-submit stuff to the DataStore). I would not mention DataPusher anywhere user-facing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just find it strange that the "DataStore" tab only appears when the datapusher plugin is enabled.. I can switch it back though
ckanext/datastore/controller.py
Outdated
extra_vars={'fields': fields}) | ||
|
||
|
||
def short_hash(field): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, I'll remove it
@wardi regarding how this will play with the DataPusher you are right in that the DataPusher will remove the table before each run but it would also be easy to retreive the current info before and resubmit it (we are already calling |
for datapusher the field types shouldn't be preserved, just the value of the "info" field (currently "label" and "notes" but some sites may extend that however they see fit) |
Great stuff @wardi |
Hi, I was exploring the use of the Data Dictionary on the dataset level when I chanced upon this. Being a beginner at CKAN, may I know the prerequisites for using this plugin and if there are screenshots of the output, may I see it? Thank you in advance! |
@JerlynPeh this one is a feature of the datastore plugin which is part of the ckan repository, so you either wait for our next release (you can run master for development) or backport the feature to the version of ckan you're running. |
@wardi Thanks for your response! How do I go about backporting this feature? What I did is to copy the changes in the codes according to the commits for this feature into my version of CKAN. However, even after restarting the server and CKAN, there is no visible difference and there isn't any error with running the codes. What would you advise to do from here? |
What would be the correct way to expand this ? |
All you need to do is add your field to the template and it should get saved. |
Works good, |
@ggcatu good idea, PR welcome! |
I also added a question there. |
Any idea on how should I proceed so that any changes made in the dictionary are reflected on the Activity stream of the org? Can't seem to find any documentation on this, would preffear asking before smashing my head against the code |
@TkTech something for extended activities? |
Use postgres comments in the datastore DB to store a JSON object for each column. For now these objects may have a single "label" field containing a human-friendly label for the column in the site's default language.
These JSON objects will be returned from
datastore_search
along with the field ids and types and may be set or updated by including them in the field objects passed todatastore_create
.