Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →How to connect and process Odoo Data from Azure Databricks
Use CData, Azure, and Databricks to perform data engineering and data science on live Odoo Data
Databricks is a cloud-based service that provides data processing capabilities through Apache Spark. When paired with the CData JDBC Driver, customers can use Databricks to perform data engineering and data science on live Odoo data. This article walks through hosting the CData JDBC Driver in Azure, as well as connecting to and processing live Odoo data in Databricks.
With built-in optimized data processing, the CData JDBC driver offers unmatched performance for interacting with live Odoo data. When you issue complex SQL queries to Odoo, the driver pushes supported SQL operations, like filters and aggregations, directly to Odoo and utilizes the embedded SQL engine to process unsupported operations client-side (often SQL functions and JOIN operations). Its built-in dynamic metadata querying allows you to work with and analyze Odoo data using native data types.
About Odoo Data Integration
Accessing and integrating live data from Odoo has never been easier with CData. Customers rely on CData connectivity to:
- Access live data from both Odoo API 8.0+ and Odoo.sh Cloud ERP.
-
Extend the native Odoo features with intelligent handling of many-to-one, one-to-many, and many-to-many data properties. CData's connectivity solutions also intelligently handle complex data properties within Odoo. In addition to columns with simple values like text and dates, there are also columns that contain multiple values on each row. The driver decodes these kinds of values differently, depending upon the type of column the value comes from:
- Many-to-one columns are references to a single row within another model. Within CData solutions, many-to-one columns are represented as integers, whose value is the ID to which they refer in the other model.
- Many-to-many columns are references to many rows within another model. Within CData solutions, many-to-many columns are represented as text containing a comma-separated list of integers. Each value in that list is the ID of a row that is being referenced.
- One-to-many columns are references to many rows within another model - they are similar to many-to-many columns (comma-separated lists of integers), except that each row in the referenced model must belong to only one in the main model.
- Use SQL stored procedures to call server-side RFCs within Odoo.
Users frequently integrate Odoo with analytics tools such as Power BI and Qlik Sense, and leverage our tools to replicate Odoo data to databases or data warehouses.
Getting Started
Install the CData JDBC Driver in Azure
To work with live Odoo data in Databricks, install the driver on your Azure cluster.
- Navigate to your Databricks administration screen and select the target cluster.
- On the Libraries tab, click "Install New."
- Select "Upload" as the Library Source and "Jar" as the Library Type.
- Upload the JDBC JAR file (cdata.jdbc.odoo.jar) from the installation location (typically C:\Program Files\CData[product_name]\lib).
Connect to Odoo from Databricks
With the JAR file installed, we are ready to work with live Odoo data in Databricks. Start by creating a new notebook in your workspace. Name the notebook, select Python as the language (though Scala is available as well), and choose the cluster where you installed the JDBC driver. When the notebook launches, we can configure the connection, query Odoo, and create a basic report.
Configure the Connection to Odoo
Connect to Odoo by referencing the class for the JDBC Driver and constructing a connection string to use in the JDBC URL. Additionally, you will need to set the RTK property in the JDBC URL (unless you are using a Beta driver). You can view the licensing file included in the installation for information on how to set this property.
driver = "cdata.jdbc.odoo.OdooDriver" url = "jdbc:odoo:RTK=5246...;User=MyUser;Password=MyPassword;URL=http://MyOdooSite/;Database=MyDatabase;"
Built-in Connection String Designer
For assistance in constructing the JDBC URL, use the connection string designer built into the Odoo JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.odoo.jar
Fill in the connection properties and copy the connection string to the clipboard.
To connect, set the Url to a valid Odoo site, User and Password to the connection details of the user you are connecting with, and Database to the Odoo database.
Load Odoo Data
Once the connection is configured, you can load Odoo data as a dataframe using the CData JDBC Driver and the connection information.
remote_table = spark.read.format ( "jdbc" ) \ .option ( "driver" , driver) \ .option ( "url" , url) \ .option ( "dbtable" , "res_users") \ .load ()
Display Odoo Data
Check the loaded Odoo data by calling the display function.
display (remote_table.select ("name"))
Analyze Odoo Data in Azure Databricks
If you want to process data with Databricks SparkSQL, register the loaded data as a Temp View.
remote_table.createOrReplaceTempView ( "SAMPLE_VIEW" )
The SparkSQL below retrieves the Odoo data for analysis.
% sql SELECT name, email FROM res_users
The data from Odoo is only available in the target notebook. If you want to use it with other users, save it as a table.
remote_table.write.format ( "parquet" ) .saveAsTable ( "SAMPLE_TABLE" )
Download a free, 30-day trial of the CData JDBC Driver for Odoo and start working with your live Odoo data in Azure Databricks. Reach out to our Support Team if you have any questions.