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

Anuj, Singh (Cognizant) 25 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.
4,441 questions
Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
1,955 questions
Azure Database for PostgreSQL
{count} votes

Accepted answer
  1. PRADEEPCHEEKATLA-MSFT 78,986 Reputation points Microsoft Employee
    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.

    0 comments No comments

0 additional answers

Sort by: Most helpful