Forum Discussion

my_patil's avatar
my_patil
Regular Visitor
4 months ago
Solved

Change Python script data source to Postgresql in Power BI

Hi friends,

currently I used Python scripts as datasource in my Power BI dashboard where data is coming from Odoo server. Now I have set up Postgresql as staging database but I don't know how to change data source from Python script to Postgresql. When I click on data source setting in power query then select python script then it doesnot show change source option.Please help me to how to achive this.Thanks in advance!!

 

 

  • Hi my_patil,

     

    Yes — this happens because Python Script is treated as a special source type in Power BI. Unlike SQL/Excel/Web sources, it usually does not expose a normal “Change Source” button in Data Source Settings.

    To move from Python script (Odoo API pull) to PostgreSQL staging DB, you’ll need to replace the source inside Power Query Editor.

     

    What you can do it create a query in Transform data, connect it to the Postgresql source and load the required table. now go to advance editor and copy the source code, for e.g.

     

    let
    Source = PostgreSQL.Database("ServerName","DBName"),
    sales_orders = Source{[Schema="public",Item="sales_orders"]}[Data],
    ChangedType = ...
    FilteredRows = ...
    in
    FilteredRows

     

    Copy the first lines where you are connecting to the table and replace your older version source (Python script) with these lines, Make Sure "Keep all transformation steps and only replace Source step."

     

    🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
    💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
    🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
    🔗 Curious to explore more? [Discover here].
    Let’s keep building smarter solutions together! 

3 Replies

  • Hi my_patil,

     

    Yes — this happens because Python Script is treated as a special source type in Power BI. Unlike SQL/Excel/Web sources, it usually does not expose a normal “Change Source” button in Data Source Settings.

    To move from Python script (Odoo API pull) to PostgreSQL staging DB, you’ll need to replace the source inside Power Query Editor.

     

    What you can do it create a query in Transform data, connect it to the Postgresql source and load the required table. now go to advance editor and copy the source code, for e.g.

     

    let
    Source = PostgreSQL.Database("ServerName","DBName"),
    sales_orders = Source{[Schema="public",Item="sales_orders"]}[Data],
    ChangedType = ...
    FilteredRows = ...
    in
    FilteredRows

     

    Copy the first lines where you are connecting to the table and replace your older version source (Python script) with these lines, Make Sure "Keep all transformation steps and only replace Source step."

     

    🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
    💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
    🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
    🔗 Curious to explore more? [Discover here].
    Let’s keep building smarter solutions together! 

    • v-menakakota's avatar
      v-menakakota
      Community Support

      Hi my_patil ,
      Thanks for reaching out to the Microsoft fabric community forum. 


      I would also take a moment to thank  grazitti_sapna , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference. 
      I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you.

      Best Regards, 
      Community Support Team

      • v-menakakota's avatar
        v-menakakota
        Community Support

        Hi my_patil ,

        I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you.

        Best Regards, 
        Community Support Team