dureach.contacts.query and dureach.trade.query accept read-only SQL over the documented contacts and shipment datasets. Use one SELECT with approved columns; joins and writes are not supported.
Which views and columns are allowed?
| Tool | View | Columns |
|---|---|---|
dureach.contacts.query | contacts | id, full_name, job_title, company_name, company_domain, city, country |
dureach.trade.query | bol_shipments | id, source_type, trade_flow, bol_number, actual_arrival_date, shipper_name, consignee_name, product_desc |
Query only these columns. Unknown tables, columns, or database prefixes return a validation error. product_desc is truncated to 300 characters in results.
What SQL shape is accepted?
- Single
SELECTwith optionalWHERE,GROUP BY,HAVING, andORDER BY. Aliases are allowed. - Comparisons, boolean operators, arithmetic, literal
IN, andLIKEare supported. - Aggregate and scalar functions:
count,sum,avg,min,max,uniqExact,lower,upper,length,coalesce,toDate,toYear,toMonth. - Rejected: joins, subqueries, CTEs, window functions,
SETTINGS,FORMAT, SQLLIMIT/OFFSET,SELECT SETTINGS,GROUP BY WITH TOTALS, globalIN, and positionalORDER BY. - SQL must be at most 16 KiB UTF-8. Larger statements return a validation error before execution.
{
"sql": "SELECT company_name, city, country FROM contacts WHERE country = 'DE' AND company_domain LIKE '%gmbh%' ORDER BY company_name, city",
"page": 1,
"limit": 25
}Page 2 and higher require ORDER BY. Use ordering supported by the tool schema and add a permitted tie breaker where available. Ties and source updates can move rows between pages; bounded results are not a complete export.
How does pagination work?
Use page (1–20) and limit (1–50). Do not append SQL LIMIT/OFFSET. Results return column names, ClickHouse types, and ordered row arrays without a total count:
{
"columns": [{"name": "company_name", "type": "String"}],
"rows": [["Example GmbH"]],
"page": 1,
"limit": 25
}UUID, date, decimal, and integers outside the JSON-safe range arrive as strings; non-finite floats arrive as strings. A result larger than 1 MiB returns result_too_large; narrow the column list or filters and retry.
How should errors be handled?
| Code | Meaning | Fix |
|---|---|---|
validation error on sql | Disallowed keyword, table, column, or shape. | Keep one SELECT on the listed view and columns; remove joins, subqueries, CTEs, SETTINGS, FORMAT, and SQL LIMIT. |
SQL exceeds 16 KiB | Statement too large. | Shorten predicates or split the question into smaller queries. |
missing ORDER BY on page 2+ | Offset page is not deterministic. | Add ORDER BY with a unique tie breaker. |
quota_exceeded (contacts_daily) | Daily contacts budget spent. | Wait until reset or ask an admin about plan limits. |
result_too_large | Wire result over 1 MiB. | Select fewer columns, add filters, or lower limit. |
Log the request_id and error code. Never log full SQL with customer identifiers alongside tokens.