Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix web view

Andreye3daf4b94a1e
diff --git a/backend/src/ee/services/pam-web-access/snowflake/pam-snowflake-connection-controller.ts b/backend/src/ee/services/pam-web-access/snowflake/pam-snowflake-connection-controller.ts
index f64bd70935..9cdc16fc67 100644
--- a/backend/src/ee/services/pam-web-access/snowflake/pam-snowflake-connection-controller.ts
+++ b/backend/src/ee/services/pam-web-access/snowflake/pam-snowflake-connection-controller.ts
@@ -25,6 +25,18 @@ import { connectThroughRelay } from "./pam-snowflake-relay-client";
const MAX_ROWS = 1000;
+const asDateOnly = (rows: Record<string, unknown>[], dateColumns: string[]) => {
+ if (dateColumns.length === 0) return rows;
+ return rows.map((row) => {
+ const next = { ...row };
+ for (const name of dateColumns) {
+ const value = next[name];
+ if (value instanceof Date) next[name] = value.toISOString().slice(0, 10);
+ }
+ return next;
+ });
+};
+
const readRows = (
statement: snowflake.RowStatement
): Promise<{ rows: Record<string, unknown>[]; truncated: boolean }> =>
@@ -140,8 +152,12 @@ export const createSnowflakeConnectionController = async (params: ControllerPara
lastCommand = extractCommand(statementSql);
isInTransaction = nextTransactionState(lastCommand, isInTransaction);
- lastRows = rows;
- lastFields = (statement.getColumns() ?? []).map((column) => ({ name: column.getName() }));
+ const columns = statement.getColumns() ?? [];
+ lastRows = asDateOnly(
+ rows,
+ columns.filter((column) => column.getType()?.toLowerCase() === "date").map((column) => column.getName())
+ );
+ lastFields = columns.map((column) => ({ name: column.getName() }));
// The driver reports -1, not undefined, when nothing was updated, so a SELECT falls through
const updatedRows = statement.getNumUpdatedRows();
lastRowCount =
diff --git a/backend/src/ee/services/pam-web-access/snowflake/pam-snowflake-relay-client.ts b/backend/src/ee/services/pam-web-access/snowflake/pam-snowflake-relay-client.ts
index 3f753a45bb..56adae5ec6 100644
--- a/backend/src/ee/services/pam-web-access/snowflake/pam-snowflake-relay-client.ts
+++ b/backend/src/ee/services/pam-web-access/snowflake/pam-snowflake-relay-client.ts
@@ -13,6 +13,7 @@ export const connectThroughRelay = async (relayPort: number, account: string): P
password: "pam",
accessUrl: `http://127.0.0.1:${relayPort}`,
application: "Infisical",
+ fetchAsString: ["Boolean", "Number"],
timeout: STATEMENT_TIMEOUT_MS
});
diff --git a/frontend/src/pages/pam/PamDataExplorerPage/sql-generation.ts b/frontend/src/pages/pam/PamDataExplorerPage/sql-generation.ts
index 17ae029ac9..eb39af818b 100644
--- a/frontend/src/pages/pam/PamDataExplorerPage/sql-generation.ts
+++ b/frontend/src/pages/pam/PamDataExplorerPage/sql-generation.ts
@@ -131,7 +131,7 @@ export function buildCountQuery(params: {
const { schema, table, filters, dialect = "postgres" } = params;
const tableName = `${quoteIdent(schema, dialect)}.${quoteIdent(table, dialect)}`;
const where = buildWhereClause(filters, dialect);
- return `SELECT COUNT(*) AS count FROM ${tableName}${where}`;
+ return `SELECT COUNT(*) AS ${quoteIdent("count", dialect)} FROM ${tableName}${where}`;
}
export function buildInsertQuery(params: {