cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Unity Catalog

roshanjoebenny
Visitor

When I try to connect my local postgres with databricks unity catalog I am facing issues. Could you please explain the steps in doing that

6 REPLIES 6

ozaaditya
New Contributor II

Hi,

You can take the help of the documentation shared below,

https://learn.microsoft.com/en-us/azure/databricks/query-federation/postgresql 

CREATE CONNECTION <connection-name> TYPE postgresql
OPTIONS (
host '<hostname>',
port '<port>',
user '<user>',
password '<password>'
);
When I am running the above code mentioned in the documentation I am getting errors

 

CREATE CONNECTION <connection-name> TYPE postgresql
OPTIONS (
host '<hostname>',
port '<port>',
user '<user>',
password '<password>'
);
When I am running the above code mentioned in the documentation I am getting errors

 

-werners-
Esteemed Contributor III

Again: is your local network and the database open for external connections?
Do you have a static ip (or dynDNS)?

yes I have opened the database for external connections and its static.

driver = "org.postgresql.Driver"

database_host = "<database-host-url>"
database_port = "5432" # update if you use a non-default port
database_name = "<database-name>"
table = "<table-name>"
user = "<username>"
password = "<password>"

url = f"jdbc:postgresql://{database_host}:{database_port}/{database_name}"

remote_table = (spark.read
.format("jdbc")
.option("driver", driver)
.option("url", url)
.option("dbtable", table)
.option("user", user)
.option("password", password)
.load()
)
I have also tried this code also and this also has the issues

 

-werners-
Esteemed Contributor III

Databricks does not have connectivity to your local network out of the box.
You should setup a VNet and VNet peering (and also firewall rules).
Connect your Azure Databricks workspace to your on-premises network - Azure Databricks | Microsoft L...

Networking - Azure Databricks | Microsoft Learn

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group