-
-
Notifications
You must be signed in to change notification settings - Fork 2
incendium.db.get_data
César Román edited this page Feb 11, 2022
·
19 revisions
Get data by executing a stored procedure.
Args:
- stored_procedure (str): The name of the stored procedure to call.
- database (str): The name of the database connection to execute against. If omitted or "", the project's default database connection will be used. Optional.
- params (list[InParam]): A Dictionary containing all INPUT parameters. Optional.
Returns:
- Dataset: A Dataset that is the resulting data of the stored procedure call, if any.
None.
Passing parameters.
from __future__ import print_function
from incendium import db
from incendium.db import InParam
from java.lang import Exception as JException
def get(int_param):
"""Get a row from the database."""
data = None
try:
params = [InParam("int_param", system.db.INTEGER, int_param)]
data = db.get_data("schema.stored_procedure", params)
except JException as e: # system.db functions throw java.lang.Exception
# TODO: Handle exception.
print(repr(e))
finally:
return data
Passing no parameters.
from __future__ import print_function
from incendium import db
from java.lang import Exception as JException
def get_all():
"""Get multiple rows of data from the database."""
data = None
try:
data = db.get_data("schema.stored_procedure")
except JException as e: # system.db functions throw java.lang.Exception
# TODO: Handle exception.
print(repr(e))
finally:
return data