CustomerData
- class q2_sdk.hq.db.customer_data.CustomerDataRow(element, row_class=None, rename_fields=None)[source]
Bases:
TableRow
- class q2_sdk.hq.db.customer_data.CustomerData(logger, hq_credentials=None, ret_table_obj=None)[source]
Bases:
DbObject
Allows for DB storage on a per customer basis. Combines the Q2_CustomerData and Q2_CustomerDataElements tables
Programmatic access to the Q2 database. Not as flexible as a true ORM, but takes the guesswork out of database schemas and ensures safety in the transactions.
- Parameters:
logger – Reference to calling request’s logger (self.logger in your extension)
hq_credentials (
Optional
[HqCredentials
]) – HQ Connectivity Information (Defaults to settings file)ret_table_obj (
Optional
[bool
]) – Flag to return list of LXML elements ifFalse
or TableRow objects from DB calls ifTrue
(Defaults to settings file)
- REPRESENTATION_ROW_CLASS
alias of
CustomerDataRow
- RESPONSE_FIELDS = ['DataID', 'ShortName', 'CustomerID', 'GTDataValue', 'FileID', 'CreateDate', 'DisplayName']
- async get(customer_id, short_name, no_trunc=False, serialize_for_cli=False)[source]
Gets the specific customer data information for the given customer id and short name :type customer_id:
int
:param customer_id: customer identifier :type short_name:str
:param short_name: customer data short name :type no_trunc: :param no_trunc: bool that will truncate the data value if it is too long to display in the CLI :type serialize_for_cli: :param serialize_for_cli: Used when running from the command line :rtype:List
[CustomerDataRow
] :return: customer data value for the given inputs
- async get_by_short_name(short_name, no_trunc=False, serialize_for_cli=False)[source]
This will get all rows that have this short_name available in Q2_CustomerData
- Return type:
- async get_by_value(short_name, value, no_trunc=False, serialize_for_cli=False)[source]
- Return type:
- async get_multi(customer_id, serialize_for_cli=False, no_trunc=False)[source]
Returns all customer data associated with the given customer id :type customer_id:
int
:param customer_id: customer identifier :rtype:List
[CustomerDataRow
] :return: customer data values for the associated customer