Open larsthelord opened 1 month ago
Thanks @larsthelord for trying PSDuckDB and reporting thi.
Hmm, not sure. Could you share the script? You can also try psduckdb
in the console.
duckdb.dll
is here https://github.com/dfinke/PSDuckDB/tree/main/lib and should be local when you do the install-module
The script is as simple as it gets.
$ErrorActionPreference = "Stop"
Import-Module PsDuckDb
try{
$db = New-DuckDBConnection
$db.Open()
} catch {
$err = $_
Get-Error
}
I don't know if you're familiar with Azure Automation, but it's basically a kind of sandbox in Azure that lets you PowerShell scripts.
The modules are installed via a Module-handler in Azure
I did find the duckdb.dll in the repo. But what is it compiled from?
Yes familiar with Az automation. I have not tried PSDuckDB there.
Are you running it on linux?
Here are details on it. I installed it from the nuget package.
The $PsVersiontalbe in Automation Account says that it is running on Windows, but it is som kind of stripped down container thing. It doesn't allow you to do all of the usual stuff.
$PsVersionTable:
from here (https://learn.microsoft.com/en-us/azure/automation/automation-runbook-execution)
I built the DuckDb.dlls for linux and Windows. Got it working in PowerShell in wsl when including the .so-file, but when running it in Automation Account it now throws a different error:
So I don't think it is running on Linux.
I also tried adding the windows duckdb.dll and the libduckdb.so, but it just went back to the original exception
I've done some more reading. I see that the duckdb.dll is an unmanaged dll compiled from C. This might be the reason is won't work in Azure Automation, and that there is some restriction on unmanaged code.
And when it comes to if the Automation Account is Linux or Windows? It has a weird naming convention for its folders that is a mix of Windows and Linux standard.
Here is cwd, and the ModulePath for PsDuckDb
When I get some time, I will try creating a simple unmanaged dll, then referencing it in another dll to see if the same problem appears. I will also have a look at putting the unmanaged dll into a combined dll to see if that makes a difference
@larsthelord thanks for digging in!
@larsthelord DuckDB update to a new version. I updated PSDuckDB.
It now works on my local PS 5.1. Give it a try.
When opening the connection for DataSource = :memory:, the duckdb.dll i not located when running this module in Azure Automation. Tested both for Powershell 5.1 and PowerShell 7.2
Throwing exception points to DuckDBConnectionStringBuilder:
but the stack trace shows that the duckdb.dll cannot be found:
I am unsure where the duckdb.dll originates from. I couldn't find it in the DuckDB.NET-repo either, Could you share some information here and i could try to help debugging this.