Load a Schema from a DRDL File
The schema generation tool mongodrdl
outputs a schema
file in Document Relational Definition Language (DRDL)
format. Examine the generated schema's table structure and field types
to verify that the generated schema supports your reporting
requirements.
You can manually edit the schema definition files to perform the following actions:
Add fields that
mongodrdl
didn't discover within the subset of documents that it sampledRemove fields
Remove tables
Rename tables, so long as the
collection
field remains the sameRename fields using the
sqlname
option
Important
To apply any changes you make to your DRDL files, you must restart
mongosqld
.
Note
BI Connector does not recognize geospatial fields when reading from a view.
When you're done editing your .drdl
file, you can follow the steps in
one of the following options:
Option 1. Upload the schema, give it a name, and start
mongosqld
, specifying both the schema's name, source, and mode, as in the following steps:Use
mongodrdl
toupload
the schema to your MongoDB deployment, similar to the following example:mongodrdl upload --host <hostName> --schemaSource schemas --drdl ./movies.drdl The string representation of the ObjectId of the uploaded schema is returned:
5d793f3f6a26a3ce66c304ea Name your schema, using the
name-schema
command, similar to the following example:mongodrdl name-schema --name movies --schemaSource schemas --schema 5d793f3f6a26a3ce66c304ea Start
mongosqld
with a named schema, using--schemaSource
,--schemaMode
, and--schemaName
options, similar to the following example:mongosqld --schemaMode custom --schemaSource schemas --schemaName movies
Option 2. Start
mongosqld
with the--schema
option to specify the path to the.drdl
schema file.