Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
Analitika
Post Prodigy
Post Prodigy

ODBC connection in PostgreSQL

Hello,

 

One Power BI report was based on Sybase but some tables need to use more database which based on PostgreSQL. Do I need to create a new queries or where build a connection. Do I need use 

to ODBC:

 

Source= Odbc.Query("driver={PostgreSQL Unicode(x64)};server=server_name;port=5432;database=db_name", "select … ")

So how to resolve it?

4 REPLIES 4
Anonymous
Not applicable

Hi @Analitika ,

Do you want to change the data source from Sybase to PostgreSQL? Or keep Sybase and add PostgreSQL as data source to get more table info? If you want to change the data source, if you refer the content in the following links.

How to change data source in Power BI

Change Data source

And you can refer the following blog to know how to connect to PostgreSQL.

Connecting Power BI To PostgreSQL

Best Regards

Here is the sql with wrong syntax, so how to fix it? I am tring to convert sybase sql to postgresql. Below is picture with errors:

Analitika_0-1630669840788.png

 

Anonymous
Not applicable

Hi @Analitika ,

Please update PostgreSQL query as below and check whether it can run successfully without error:

SELECT ZUO_KOD,
       DID_NR,
       ADM_VAR,
       DID_DAT,
       Eil.skaicius
FROM
  (SELECT rows.ZUO_KOD AS ZUO_KOD,
          rows.DID_NR AS DID_NR,
          rows.ADM_VAR AS ADM_VAR,
          rows.DID_DAT,
          count(1) AS Eil.skaicius
   FROM
     (SELECT ot.ZUO_KOD,
             ot.DID_NR,
             ot.ADM_VAR,
             ot.DID_DAT
      FROM
        (SELECT ID_VIDP AS ID_VIDP2,
                ZUO_KOD AS ZUO_KOD,
                DID_NR AS DID_NR,
                ADM_VAR AS ADM_VAR,
                DID_DAT AS DID_DAT
         FROM [DBA].VIDP
         WHERE DID_DAT >= '" &sFilterDate&"') ot
      LEFT OUTER JOIN DBA.VIDP1 ine ON (ot.ID_VIDP2 = ine.ID_VIDP)) ROWS
   GROUP BY ZUO_KOD,
            DID_NR,
            ADM_VAR,
            DID_DAT)

You can  refer the content in the following link to write PostgreSQL query and use pgFormatter to format your PostgreSQL query.

PostgreSQL Tutorial

Best Regards

Hello,

 

I would like to convert Sybase SQL query to PostgreSQL query. I have working Sybase query but I don't get how apply it to PostgreSQL database. I tried to modify the Sybase query in order to get PostgreSQL query, but getting many syntax errors which I can't fix.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.