Get workbook metadata for multiple workbooks owned by a particular user.
I have a customer who is running version 6.1.25. They are looking to export metadata from a workbook to a metadata management tool. I gave them our workbook REST API call to export workbook info to JSON and extract the required metadata info (curl -u <username>:<password> -X GET 'http://<Datameer-serverIP>:<port-number>/rest/workbook/<workbook-configuration-id>').
However, their follow up ask is: "If I need the metadata of multiple workbooks for a particular user, I thought it may easy to get it from dap database. Is it possible to tie the workbook table (workbook_sheet_data) on dap database to the user table? I couldn’t find the link."
What is the best approach here to have the equivalent of the output of the workbook REST API but for multiple worksbook that belong to a user ID? Would it be some combination of the following queries?
SELECT df.name ArtifactName, df.extension, perm.owner Owner, djc.id ConfigID, djc.dap_file__id FileID, df.uuid UUID FROM dap_file df, dap_job_configuration djc, permission perm WHERE df.file_mode = "NORMAL" AND djc.dap_file__id = df.id AND perm.id = df.permission_fk AND perm.owner LIKE "admin" AND df.extension="WORKBOOK_EXTENSION";
select * from workbook_sheet_data WHERE ....? (How do we identify all the sheets that belong to a workbook and to a user)
Any suggestions would help!
Thanks
Nikhil
-
Nikhil, I think this foreign-key chain will get you what you need. Let me know if this answers your question or if there is any further clarification I can add.
- workbook_configuration.id => dap_job_configuration.id
- dap_job_configuration.dap_file__id => dap_file.id
- dap_file.permission_fk => permission.id (permission.owner is the owner of the workbook)
As usual with any query based solution, it's important to mention that the underlying schema may change as Datameer versions change. The APIs are much more stable in terms of availability as Datameer is upgraded. Though a database query may be quicker to implement it may be more difficult to maintain in the future.
Please sign in to leave a comment.
Comments
1 comment