For the complete documentation index, see llms.txt. This page is also available as Markdown.

dap syncdb

Synchronize table data changes to a database.

Automatically retrieves incremental updates of a table, connects to your database, and applies these updates to the target table. This process is handled within a single atomic transaction, ensuring that, in case of an error, the data in your database remains consistent. Only tables that were created by dap initdb can be synchronized using dap syncdb.

With several tables, a table your key is not allowed to read (see Table access) fails on its own and the remaining tables still run. The command then exits with a non-zero code.

Usage

dap [arguments] syncdb [flags]

Options

--namespace <string> Specifies the data source (namespace). Available options: {canvas, canvas_logs, catalog, new_quizzes}.

--table <string> Specifies the table(s) to fetch data from. Can be a single table name, a comma separated list of table names or the special all keyword to fetch all tables in the namespace. all covers the tables your key is allowed to read — see Table access.

Global options

--base-url <string> Base URL of the DAP API. Skip, if the DAP_API_URL environment variable is set.

--client-id <string> Client ID obtained from the Identity Service. Skip, if DAP_CLIENT_ID environment variable is set.

--client-secret <string> Client Secret obtained from the Identity Service. Skip, if DAP_CLIENT_SECRET environment variable is set.

--connection-string <string> The connection string used to connect to the target database. It must follow RFC 3986 format: dialect://username:password@host:port/database. Skip, if DAP_CONNECTION_STRING environment variable is set.

-h, --help Displays help information for the command.

Examples

Get new or modified records of the courses table from the canvas namespace and insert into your database: $ dap syncdb --namespace canvas --table courses

Get new or modified records of multiple tables or all tables of the canvas namespace: $ dap syncdb --namespace canvas --table courses,users,wikis $ dap syncdb --namespace canvas --table all

Same example with the connection string defined in the command $dap syncdb --namespace canvas --table courses --connection-string postgresql://scott:password@server.example.com/testdb

Error handling

Scenario
Exit code
Error output

Table not initialized by initdb

5

ERROR - Table not initialized. Please run initdb first, or check that the namespace, table name and connection string are correct.

Table the key is not allowed to read

5

ERROR - Requested access to '<namespace>/<table>' was not granted by the token issuer.

Some tables of several failed

5

ERROR - Operation syncdb completed with issues: <n> failed out of <m> table(s).

Missing base URL

5

ERROR - Missing DAP API base URL. Please provide the base URL of your regional API Gateway before proceeding.

Last updated

Was this helpful?