UserPropertyData

class q2_sdk.hq.db.user_property_data.UserPropertyDataRow(element, row_class=None, rename_fields=None)[source]

Bases: TableRow

UserPropertyDataID: int
UISourceID: int
GroupID: int
ProductTypeID: int
ProductID: int
CustomerID: int
UserID: int
UserRoleID: int
HostAccountID: int
PropertyID: int
PropertyValue: str
PropertyName: str
PropertyDataType: str
Weight: int
CategoryShortName: str
CategoryDescription: str
class q2_sdk.hq.db.user_property_data.UserPropertyData(logger, hq_credentials=None, ret_table_obj=None)[source]

Bases: DbObject

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 if False or TableRow objects from DB calls if True (Defaults to settings file)

REPRESENTATION_ROW_CLASS

alias of UserPropertyDataRow

add_arguments(parser)[source]

Hook for subclassed DbObjects to add custom arguments.

async get(user_property_name, user_id=None, group_id=None, customer_id=None, host_account_id=None, ui_source=None, product_id=None, product_type_id=None, return_count=10, strict=True, no_trunc=False, serialize_for_cli=False, user_role_id=None)[source]
Return type:

list[UserPropertyDataRow]

async get_by_value(property_value, user_property_name, no_trunc=False, serialize_for_cli=False)[source]
Return type:

list[UserPropertyDataRow]

async get_by_property_id(property_id)[source]

This method will return user_property_data using by PropertyID.

Return type:

list[UserPropertyDataRow]

async get_by_group(user_property_name, serialize_for_cli=False)[source]

This method will include the default property value in the return. The default value will be the only value that does not have a group id associated

Return type:

list[UserPropertyDataRow]

async get_by_group_with_id(user_property_id)[source]

This method will include the default property value in the return. The default value will be the only value that does not have a group id associated

Return type:

list[UserPropertyDataRow]

async get_by_user_id(user_id, user_property_name=None, user_property_id=None)[source]
Return type:

list[UserPropertyDataRow]

async get_by_customer_id(customer_id, user_property_name=None, user_property_id=None)[source]
Return type:

list[UserPropertyDataRow]

async create(property_name, property_value, user_id=None, group_id=None, customer_id=None, host_account_id=None, ui_source=None, product_id=None, product_type_id=None, product_name=None, product_type_name=None, user_role_id=None)[source]
async update(property_name, property_value, user_id=None, group_id=None, customer_id=None, host_account_id=None, ui_source=None, product_id=None, product_type_id=None, product_name=None, product_type_name=None, user_role_id=None)[source]
async update_by_id(user_property_data_id, property_name, property_value)[source]
async create_or_update(property_name, property_value, user_id=None, group_id=None, customer_id=None, host_account_id=None, ui_source=None, product_id=None, product_type_id=None, product_name=None, product_type_name=None, user_role_id=None)[source]

There may be times when we want to error if a row already exists (create only). This method exists in case you just want a row to be there after you’re done calling the function, regardless of the initial state of the DB

async delete(property_name, user_id=None, group_id=None, customer_id=None, host_account_id=None, ui_source=None, user_role_id=None, **kwargs)[source]
async delete_all_property_data(property_name)[source]
async delete_default_value(short_name, is_form)[source]