import_from_query
Run SQL against a configured external database connection and import the result into an Azquo database. THE SERVER CONNECTS AND FETCHES - the rows never pass through your context, and the credentials are held server-side, so you never see or supply them.
This is the right tool for a business's own internal database. Use list_external_connections to see what is configured; if the source you need is not there, ask an administrator to add it in azquo-admin rather than looking for another route.
TWO WAYS TO SAY WHAT THE COLUMNS MEAN, and you need one of them: Supply 'headings' - a tab-separated Azquo header line matching the SELECT order. The source's own column names are discarded. Right for a one-off load. Omit 'headings' - the source's column names are kept as the header row, and the target database's IMPORT TEMPLATE interprets them. Right for a recurring feed, because the mapping then lives server-side instead of being restated on every run. Check list_import_templates for the database first.
Imported by the same path as POST /api/importdata, so the usual header grammar applies (see Azquo_Skills > Import). Check 'values adjusted' in the result against what you expected.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL to run against that connection. Read-only queries only - this is an import. | |
| database | Yes | Target Azquo database name | |
| filename | No | File name to import under. Import instructions are parsed from it, so it matters. Defaults to <connection>_query.tsv | |
| headings | No | OPTIONAL. Tab-separated Azquo header line, one heading per selected column in the order the SQL returns them. SUPPLY IT for a one-off load: the source's own column names are then discarded and yours are used. OMIT IT for a recurring feed that the target database has an IMPORT TEMPLATE for: the source's column names are kept as the header row and the template interprets them. One or the other is needed - with neither, the import has nothing to tell it what the columns mean. | |
| connection | Yes | Name of the external database connection, from list_external_connections |