The Database category lists reading & writing features on an Adobe Campaign instance. The same read or write can be expressed at several levels of abstraction, and picking the right one determines velocity, maintainability, and operational risk.
Start high, drop down only when you have to: Workflow > Schema API > SQL, from the most approachable to the most performant.
Choosing a data level
To read or write business data, reach for the highest level that fits:
| Level | Best for | API | Use cases | Abstraction | Speed |
|---|---|---|---|---|---|
| Workflow | π§βπΌ Ease of use | Query, Update data, List update | Most marketing campaigns with a workflow. Visual, easy to build and share | Low code | 1 sec |
| Schema API | π οΈ Automation |
π queryDef to read; NLWS.xtkSession.Write or the Entity API to write |
You need automation: loops with conditions, calling SQL via JSON, reading files/CSV | JavaScript code | 1-2 ms |
| SQL | ποΈ Performance |
π sqlSelect to read, π sqlExec to write |
Only what the levels above canβt express: high-performance database calls | SQL Code | 50β250 Β΅s |
Schema API
At the Schema API level, two write styles coexist. The declarative writer xtk.session.Write takes a document describing the changes (_operation="insertOrUpdate" with a _key) β use it for batches and idempotent upserts. The object-oriented Entity API loads a record, lets you change its attributes, then persists them with save() β use it to edit a single, known record:
var delivery = NLWS.nmsDelivery.load("12435");
delivery.label = "Spring campaign";
delivery.save();
Because it reads before it writes, the Entity API is the most convenient for one record and the worst for many β never call it in a loop. Batch with the writer or a workflow activity instead.
So raw SQL is not forbidden β it is a deliberate choice. Drop to it when the code is trusted and the path is hot, not as a default. For everything else, stay on queryDef and workflow activities.
SQL
Raw SQL is the privileged level: server JavaScript runs as the operator, so a query is only as safe as the values you put in it.
sqlExec("UPDATE NmsDelivery SET sLabel = 'Spring campaign' WHERE iDeliveryId = 12435", id);
Modern development
These raw primitives predate modern tooling. Wherever you can, prefer queryDef with JSON and the DOM API β it is lintable, testable with jest, and formatted by prettier β and keep the logic in xtk:javascript files rather than inline in workflows or JSSP. See Modern development best practices for Adobe Campaign.