Share via

Do you know how to install the 'ODBC Driver 17 for PostgreSQL' on a Azure Databricks cluster?

AnujSinghCognizant-4026 90 Reputation points
2024-04-30T11:06:56.06+00:00

I am attempting to run postgreSQL stored procedures , through Azure Databricks notebook.

We have stored procedure written in Azure Database for PostgreSQL and we want to run postgreSQL stored procedures through Azure Databricks Notebook (using Pyspark/SQL).

Step 1: Install required libraries.

Step 2: Connect with Azure Database for PostgreSQL using ODBC.

Step 3: Execute PostgreSQL stored procedure in Databricks.

I am referring to below link,

Link - https://nachiketrajput44.medium.com/how-to-run-stored-procedure-in-azure-data-warehouse-using-databricks-caa912d123d5

Azure Synapse Analytics
Azure Synapse Analytics

An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.

Azure Databricks
Azure Databricks

An Apache Spark-based analytics platform optimized for Azure.

Azure Database for PostgreSQL

Answer accepted by question author

PRADEEPCHEEKATLA 91,861 Reputation points
2024-04-30T13:27:42.1833333+00:00

@Anuj, Singh (Cognizant) - Thanks for the question and using MS Q&A platform.Run the following commands in a single cell to install MY SQL ODBC Driver on Azure Databricks cluster.

%sh
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/

User's image

Run the following commands in a single cell to install pyodbc Driver on Azure Databricks cluster.

%sh    
apt-get -y install unixodbc-dev
/databricks/python/bin/pip install pyodbc

User's image

Connect to Azure SQL Database or Postgres using ODBC as mentined in the document:https://nachiketrajput44.medium.com/how-to-run-stored-procedure-in-azure-data-warehouse-using-databricks-caa912d123d5
User's image

For more details, refer to Connect Python and pyodbc to Azure Databricks.

Hope this helps. Do let us know if you any further queries.


If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.