Skip to content

Commit

Permalink
feat: ensure snowflake connection is read only (#7801)
Browse files Browse the repository at this point in the history
* feat: ensure snowflake connection is read only

* rebase

* enh: syncFailed + delete all tables if connection is not readonly

* check no forbidden ops

* move snowflake configure call

* fix activities code

---------

Co-authored-by: Henry Fontanier <henry@dust.tt>
  • Loading branch information
fontanierh and Henry Fontanier authored Oct 3, 2024
1 parent a7ef3ee commit bd653d5
Show file tree
Hide file tree
Showing 9 changed files with 383 additions and 155 deletions.
8 changes: 0 additions & 8 deletions connectors/src/connectors/snowflake/lib/content_nodes.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import type { ConnectorPermission, ContentNode } from "@dust-tt/types";

/**
* Some databases and schemas are not useful to show in the content tree.
* We exclude them here.
*/
export const EXCLUDE_DATABASES = ["SNOWFLAKE"];
export const EXCLUDE_SCHEMAS = ["INFORMATION_SCHEMA"];

/**
* 3 types of nodes in a remote database content tree:
* - database: internalId = "database_name"
* - schema: internalId = "database_name.schema_name"
* - table: internalId = "database_name.schema_name.table_name"
*/

export type REMOTE_DB_CONTENT_NODE_TYPES = "database" | "schema" | "table";

export const getContentNodeTypeFromInternalId = (
Expand Down
4 changes: 1 addition & 3 deletions connectors/src/connectors/snowflake/lib/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import type {
Result,
SnowflakeCredentials,
} from "@dust-tt/types";
import { Err, Ok } from "@dust-tt/types";
import { Err, EXCLUDE_DATABASES, EXCLUDE_SCHEMAS, Ok } from "@dust-tt/types";

import {
EXCLUDE_DATABASES,
EXCLUDE_SCHEMAS,
getContentNodeFromInternalId,
getContentNodeTypeFromInternalId,
} from "@connectors/connectors/snowflake/lib/content_nodes";
Expand Down
Loading

0 comments on commit bd653d5

Please sign in to comment.