Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here. Want to know more about what has changed? Check out the Community News blog.

Adding a parameter while saving the postgres query

Adding a parameter while saving the postgres query

New Contributor

I am working on the HUE for my project, i have to save a parameter along with the metadatas while creating a postgres query,i have added my parameter in the client post request by altering the "notebook.ko.js" file present in the "/hue/desktop/libs/notebook/src/notebook/static/notebook/js/" location, now i have to save that parameter in the "desktop_document2"  database table ,for that i have altered the code in "" file present in the /hue/desktop/libs/notebook/src/notebook/ location,i altered the code in as follows.


def _save_notebook(notebook, user):
notebook_type = notebook.get('type', 'notebook')
save_as = False

if notebook.get('parentSavedQueryUuid'): # We save into the original saved query, not into the query history
notebook_doc = Document2.objects.get_by_uuid(user=user, uuid=notebook['parentSavedQueryUuid'])
elif notebook.get('id'):
notebook_doc = Document2.objects.get(id=notebook['id'])
notebook_doc = Document2.objects.create(name=notebook['name'], uuid=notebook['uuid'], type=notebook_type, owner=user), owner=notebook_doc.owner,, description=notebook_doc.description, extra=notebook_type)
save_as = True

if notebook.get('directoryUuid'):
notebook_doc.parent_directory = Document2.objects.get_by_uuid(user=user, uuid=notebook.get('directoryUuid'), perm_type='write')
notebook_doc.parent_directory = Document2.objects.get_home_directory(user)

notebook['isSaved'] = True
notebook['isHistory'] = False
notebook['id'] =
notebook_doc1 = notebook_doc._get_doc1(doc2_type=notebook_type)
notebook_doc.update_data(notebook) = _get_statement(notebook) = = notebook['name']

--------------------------I added my param below to save---------------------------------------------------

notebook_doc.projectid= = notebook['projectid']

notebook_doc.description = notebook_doc1.description = notebook['description']

return notebook_doc, save_as


I have also created a column in the "Desktop_document2 " table to store my column,but at the server side i can't able to save,could somebody help me?