Establishing a Connection
The objects available within our connector are accessible from the "cdata.rest" module. To use the module's objects directly:
- Import the module as follows:
import cdata.rest as mod
- To establish a connection string, call the connect() method from the connector object using an appropriate connection string, such as:
mod.connect("DataModel=Relational;URI=C:\people.xml;Format=XML")
Modeling XML/JSON/CSV Data
The DataModel property controls how your data is represented into tables.
- Document (default): Model a top-level, document view of your REST data. The connector returns nested object arrays as aggregated XML/JSON/CSV objects.
- FlattenedDocuments: Implicitly join nested array objects and parent objects into a single table.
- Relational: View nested object arrays as individual, related tables containing a primary key and a foreign key that links to the parent document.
Set Format to XML, JSON, or CSV in accordance with the data structuring standard used by the REST source you want to connect to. and set DataModel to more closely match the data representation to the structure of your data.
Next Steps
- See Modeling REST Data for information on customizing schema discovery and executing SQL to REST.
- See Fine-Tuning Data Access for more advanced connection settings: fine-tune the default data modeling settings, connect through a firewall, or troubleshoot connections.