kaknikhil commented on a change in pull request #394: DL: Add model_arch column
to model data table
URL: https://github.com/apache/madlib/pull/394#discussion_r285816533
##########
File path: src/ports/postgres/modules/deep_learning/predict_input_params.py_in
##########
@@ -36,28 +34,11 @@ class PredictParamsProcessor:
self.model_table = model_table
self.model_summary_table = add_postfix(self.model_table, '_summary')
input_tbl_valid(self.model_summary_table, self.module_name)
- self.model_summary_dict = self._get_model_summary_dict()
- self.model_arch_dict = self._get_model_arch_dict()
+ self.model_summary_dict =
self._get_dict_for_table(self.model_summary_table)
+ self.model_arch_dict = self._get_dict_for_table(self.model_table)
- def _get_model_summary_dict(self):
- return plpy.execute("SELECT * FROM {0}".format(
- self.model_summary_table))[0]
-
- def _get_model_arch_dict(self):
- model_arch_table = self.model_summary_dict[MODEL_ARCH_TABLE_COLNAME]
- model_arch_id = self.model_summary_dict[MODEL_ARCH_ID_COLNAME]
- input_tbl_valid(model_arch_table, self.module_name)
- model_arch_query = """
- SELECT {0}
- FROM {1}
- WHERE {2} = {3}
- """.format(Format.MODEL_ARCH, model_arch_table, Format.MODEL_ID,
- model_arch_id)
- query_result = plpy.execute(model_arch_query)
- if not query_result or len(query_result) == 0:
- plpy.error("{0}: No model arch found in table {1} with id
{2}".format(
- self.module_name, model_arch_table, model_arch_id))
- return query_result[0]
+ def _get_dict_for_table(self, table_name):
+ return plpy.execute("SELECT * FROM {0}".format(table_name))[0]
Review comment:
we thought about it as well but i guess it doesn't hurt add limit 1
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services