Search code examples
postgresqlnpgsqlpowerquery

Using Npgsql to access postgresql from Power Query


Using Excel 2016 and trying to access a remote postgresql server with Power Query. Power Query prompts me to install npgsql. Installed the component in the GAC. Once restarted, Power Query allows me to specify the connection, however I then get the following error: Unable to Connect: We encoutered an error while trying to connect. Details: "Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=1.1.0.0, Culture=neutral,PublicKeyToken=..... or one of its dependencies. The system cannot find the file specified."

Repeated on two different environments running Excel 2016. One is 32 bit and the other is 64 bit Excel. Same error.

Anyone else encountered this? Any work around? Should I try to install this package in the GAC? Am I wrong to have installed npgsql with the GAC option?


Solution

  • The dependency on Microsoft.Extensions.Logging was introduced in 3.2, so I'm assuming you're on 3.2.0-beta1 (please confirm if otherwise).

    This is an issue with Npgsql. When using the GAC installer (the MSI), the logging dependencies should also be installed into the GAC - currently only Npgsql.dll is installed.

    You can work around this by manually installing the missing assemblies yourself - open the Developer Command Prompt as Administrator, and execute gacutil -i for the missing assemblies.