Skip to main content

CustomerDataTableLoad

Generic load class for customer-defined data tables (cdt_*). Unlike the other Load classes, the schema is dynamic — fields aren't fixed by the SDK; you set them at runtime.

Import

from lib.objects.customer_data_table import CustomerDataTableLoad

Constructor takes a table name

load = CustomerDataTableLoad(context, table_name='cost_centers')
# Hits /v1/customerdatatable/cost_centers

The table must already exist for the customer (admins set it up in the Nuntiq admin portal — connectors don't create tables, only rows).

Standard BaseLoad methods

get_all(), search(), new(), save_all(), delete_where() work as documented in baseload.md.

Setting + reading dynamic fields

Use .set() and .get() instead of attribute access:

rec = load.new()
rec.set('source_record_id', 'CC-001')
rec.set('source_system', 'SAP')
rec.set('field_1', 'EMEA Marketing')
rec.set('field_2', 'Active')
load.save_all()
for rec in load.get_all():
print(rec.get('source_record_id'), rec.get('field_1'))

Always-present fields

Even though the schema is dynamic, every record has these:

FieldNotes
idUUID, assigned by server
source_record_idYour stable external id — natural key
source_systemCombined with source_record_id, this is the upsert key
is_active / is_deletedStandard soft-delete flags
created_at / updated_atTimestamps, set by server

Full-load semantics

save_all(full_load=True) truncates the entire CDT for this customer and replaces it with what's queued. Same warning as supplier — only when you're authoritative.

Example: bulk import cost centers from ERP

from lib.objects.customer_data_table import CustomerDataTableLoad

def run(context):
load = CustomerDataTableLoad(context, table_name='cost_centers')

erp_cost_centers = fetch_cost_centers_from_erp() # returns dicts

for cc in erp_cost_centers:
rec = load.new()
rec.set('source_record_id', cc['id'])
rec.set('source_system', 'SAP')
rec.set('field_1', cc['name'])
rec.set('field_2', cc['status'])
rec.set('field_3', cc['owner_email'])

load.save_all(full_load=True)
return {'imported': len(erp_cost_centers)}

Bulk delete

load.delete_where(
parameters=[{'source_record_id': 'CC-OLD'}],
action='deactivate',
)