dap schema
Download the schema of a table.
This command generates and downloads the schema of a specific table within a specified namespace in JSON format.
Usage
dap [arguments] schema [flags]Options
--namespace <string>
Specifies the data source (namespace). Available options: {canvas, canvas_logs, catalog, new_quizzes}.
--table <string>
Specifies the tables whose schemas to fetch. 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.
--output-directory <string> (default: downloads)
Specifies the absolute or relative path to the output directory where the snapshot will be stored.
Global options
--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.
-h, --help
Displays help information for the command.
Output
Schema files are written to the output directory with the naming pattern <table>_schema_version_<N>.json, where N is a table-specific version integer. Nothing is printed to stdout.
downloads/accounts_schema_version_2.json
downloads/enrollment_terms_schema_version_1.jsonEach schema file has this top-level structure:
meta.action:"U"= upsert (insert or update),"D"= hard delete. Onlytsis always required inmeta.keyis always required and contains the primary key field(s).valuecontains the data columns. The required fields vary per table.versionis an integer that increments when the schema changes.
Error handling
Invalid table name
5
ERROR - Operation schema failed. Reason: The table name '<name>' specified in the request is not valid.
Invalid namespace
5
ERROR - The namespace '<name>' specified in the request is not valid.
Examples
Get schema of courses and users tables from the canvas namespace:
$ dap schema --namespace canvas --table courses,users
Get schema of all tables from the canvas namespace:
$ dap schema --namespace canvas --table all
Get schema to a specific directory:
$ dap schema --namespace canvas --table accounts --output-directory ./schemas
Related Resources
Last updated
Was this helpful?