Mike
Mike
WWindmill
Created by Mike on 2/22/2024 in #help
Postgres request throws ExecutionErr when trying to get value from field using enum.
We have a PostgreSQL database that we want to query. in one of the tables we use an enum as a type for one of the columns.
create type conversion_history_status_enum as enum ('done', 'failed');
create type conversion_history_status_enum as enum ('done', 'failed');
Performing just a basic SELECT status FROM conversion_history will throw this error:
ExecutionErr: error during execution of the script:
conversion issue for value at column_name `status` with type Other(Other { name: "conversion_history_status_enum", oid: 17428288, kind: Enum(["done", "failed"]), schema: "public" })
ExecutionErr: error during execution of the script:
conversion issue for value at column_name `status` with type Other(Other { name: "conversion_history_status_enum", oid: 17428288, kind: Enum(["done", "failed"]), schema: "public" })
What could be causing this? Running the same query from Datagrip for example works without any problems.
5 replies
WWindmill
Created by Mike on 2/10/2024 in #help
Trouble committing file to GitHub but only in bun runtime
I'm trying to create a script to commit font files into my github repository. This is code that is migrated over from airplane.dev. Initially i created the code using the Deno runtime, this works but I want to use fontkit, which does not support the "import ... from ..." imports. So the following code WORKS:
import * as wmill from "npm:windmill-client@1";
import { Octokit } from "npm:@octokit/rest@20.0.2";

export async function main(
font_file: wmill.Base64,
font_name: string,
font_type: string,
) {
const octokit = new Octokit({
auth: (await wmill.getVariable("f/COMPANY/GITHUB_TOKEN")),
});

const acceptedFileTypes = ["otf", "ttf"];

if (acceptedFileTypes.includes(font_type) && font_name && font_name !== "") {
const result = await octokit.repos.createOrUpdateFileContents({
owner: "OWNER",
repo: "REPO",
path: 'PATH',
message: 'MESSAGE',
content: font_file,
});

const res = await fetch(
"ENDPOINT TO NOTIFY FILE IS UPLOAD, NOT RELEVANT FOR THIS ISSUE",
);

const responseText = res.text();

return responseText || 500;
} else {
return "error: unsupported file extension, must be otf or ttf.";
}
}
import * as wmill from "npm:windmill-client@1";
import { Octokit } from "npm:@octokit/rest@20.0.2";

export async function main(
font_file: wmill.Base64,
font_name: string,
font_type: string,
) {
const octokit = new Octokit({
auth: (await wmill.getVariable("f/COMPANY/GITHUB_TOKEN")),
});

const acceptedFileTypes = ["otf", "ttf"];

if (acceptedFileTypes.includes(font_type) && font_name && font_name !== "") {
const result = await octokit.repos.createOrUpdateFileContents({
owner: "OWNER",
repo: "REPO",
path: 'PATH',
message: 'MESSAGE',
content: font_file,
});

const res = await fetch(
"ENDPOINT TO NOTIFY FILE IS UPLOAD, NOT RELEVANT FOR THIS ISSUE",
);

const responseText = res.text();

return responseText || 500;
} else {
return "error: unsupported file extension, must be otf or ttf.";
}
}
42 replies