I have the following code:
func main() {
ctx := context.Background()
client, err := dagger.Connect(ctx)
if err != nil {
panic(err)
}
defer client.Close()
fn := "commands.sql"
// Create the "commands.sql" file.
f, err := os.Create(fn)
if err != nil {
panic(err)
}
_, err = f.WriteString("SELECT name FROM sys.databases")
if err != nil {
panic(err)
}
err = f.Close()
if err != nil {
panic(err)
}
output, err := client.Pipeline("test").
Container().
From("fabiang/sqlcmd").
WithExec([]string{"-S", "ip_address", "-U", "sa", "-P", "***", "-C", "-N", "-i", "" + fn + ""}).
Stdout(ctx)
if err != nil {
panic(err)
}
fmt.Println(output[:300])
...and when I run it, I'm getting the following error:
Stderr:
Sqlcmd: 'commands.sql': Invalid filename.