diff --git a/src/graphql/generated.ts b/src/graphql/generated.ts index e94484ab..7172b2ca 100644 --- a/src/graphql/generated.ts +++ b/src/graphql/generated.ts @@ -30,7 +30,6 @@ export type Scalars = { json: { input: any; output: any }; jsonb: { input: any; output: any }; numeric: { input: any; output: any }; - timestamp: { input: any; output: any }; timestamptz: { input: any; output: any }; uuid: { input: any; output: any }; }; @@ -138,6 +137,7 @@ export type SourceMetaOutput = { export type SourceTable = { name: Scalars["String"]["input"]; + schema: Scalars["String"]["input"]; }; export type SourceTablesOutput = { @@ -1814,228 +1814,6 @@ export type Auth_Accounts_Updates = { where: Auth_Accounts_Bool_Exp; }; -/** columns and relationships of "auth.migrations" */ -export type Auth_Migrations = { - __typename?: "auth_migrations"; - executed_at?: Maybe; - hash: Scalars["String"]["output"]; - id: Scalars["Int"]["output"]; - name: Scalars["String"]["output"]; -}; - -/** aggregated selection of "auth.migrations" */ -export type Auth_Migrations_Aggregate = { - __typename?: "auth_migrations_aggregate"; - aggregate?: Maybe; - nodes: Array; -}; - -/** aggregate fields of "auth.migrations" */ -export type Auth_Migrations_Aggregate_Fields = { - __typename?: "auth_migrations_aggregate_fields"; - avg?: Maybe; - count: Scalars["Int"]["output"]; - max?: Maybe; - min?: Maybe; - stddev?: Maybe; - stddev_pop?: Maybe; - stddev_samp?: Maybe; - sum?: Maybe; - var_pop?: Maybe; - var_samp?: Maybe; - variance?: Maybe; -}; - -/** aggregate fields of "auth.migrations" */ -export type Auth_Migrations_Aggregate_FieldsCountArgs = { - columns?: InputMaybe>; - distinct?: InputMaybe; -}; - -/** aggregate avg on columns */ -export type Auth_Migrations_Avg_Fields = { - __typename?: "auth_migrations_avg_fields"; - id?: Maybe; -}; - -/** Boolean expression to filter rows from the table "auth.migrations". All fields are combined with a logical 'AND'. */ -export type Auth_Migrations_Bool_Exp = { - _and?: InputMaybe>; - _not?: InputMaybe; - _or?: InputMaybe>; - executed_at?: InputMaybe; - hash?: InputMaybe; - id?: InputMaybe; - name?: InputMaybe; -}; - -/** unique or primary key constraints on table "auth.migrations" */ -export enum Auth_Migrations_Constraint { - /** unique or primary key constraint on columns "name" */ - MigrationsNameKey = "migrations_name_key", - /** unique or primary key constraint on columns "id" */ - MigrationsPkey = "migrations_pkey", -} - -/** input type for incrementing numeric columns in table "auth.migrations" */ -export type Auth_Migrations_Inc_Input = { - id?: InputMaybe; -}; - -/** input type for inserting data into table "auth.migrations" */ -export type Auth_Migrations_Insert_Input = { - executed_at?: InputMaybe; - hash?: InputMaybe; - id?: InputMaybe; - name?: InputMaybe; -}; - -/** aggregate max on columns */ -export type Auth_Migrations_Max_Fields = { - __typename?: "auth_migrations_max_fields"; - executed_at?: Maybe; - hash?: Maybe; - id?: Maybe; - name?: Maybe; -}; - -/** aggregate min on columns */ -export type Auth_Migrations_Min_Fields = { - __typename?: "auth_migrations_min_fields"; - executed_at?: Maybe; - hash?: Maybe; - id?: Maybe; - name?: Maybe; -}; - -/** response of any mutation on the table "auth.migrations" */ -export type Auth_Migrations_Mutation_Response = { - __typename?: "auth_migrations_mutation_response"; - /** number of rows affected by the mutation */ - affected_rows: Scalars["Int"]["output"]; - /** data from the rows affected by the mutation */ - returning: Array; -}; - -/** on_conflict condition type for table "auth.migrations" */ -export type Auth_Migrations_On_Conflict = { - constraint: Auth_Migrations_Constraint; - update_columns?: Array; - where?: InputMaybe; -}; - -/** Ordering options when selecting data from "auth.migrations". */ -export type Auth_Migrations_Order_By = { - executed_at?: InputMaybe; - hash?: InputMaybe; - id?: InputMaybe; - name?: InputMaybe; -}; - -/** primary key columns input for table: auth.migrations */ -export type Auth_Migrations_Pk_Columns_Input = { - id: Scalars["Int"]["input"]; -}; - -/** select columns of table "auth.migrations" */ -export enum Auth_Migrations_Select_Column { - /** column name */ - ExecutedAt = "executed_at", - /** column name */ - Hash = "hash", - /** column name */ - Id = "id", - /** column name */ - Name = "name", -} - -/** input type for updating data in table "auth.migrations" */ -export type Auth_Migrations_Set_Input = { - executed_at?: InputMaybe; - hash?: InputMaybe; - id?: InputMaybe; - name?: InputMaybe; -}; - -/** aggregate stddev on columns */ -export type Auth_Migrations_Stddev_Fields = { - __typename?: "auth_migrations_stddev_fields"; - id?: Maybe; -}; - -/** aggregate stddev_pop on columns */ -export type Auth_Migrations_Stddev_Pop_Fields = { - __typename?: "auth_migrations_stddev_pop_fields"; - id?: Maybe; -}; - -/** aggregate stddev_samp on columns */ -export type Auth_Migrations_Stddev_Samp_Fields = { - __typename?: "auth_migrations_stddev_samp_fields"; - id?: Maybe; -}; - -/** Streaming cursor of the table "auth_migrations" */ -export type Auth_Migrations_Stream_Cursor_Input = { - /** Stream column input with initial value */ - initial_value: Auth_Migrations_Stream_Cursor_Value_Input; - /** cursor ordering */ - ordering?: InputMaybe; -}; - -/** Initial value of the column from where the streaming should start */ -export type Auth_Migrations_Stream_Cursor_Value_Input = { - executed_at?: InputMaybe; - hash?: InputMaybe; - id?: InputMaybe; - name?: InputMaybe; -}; - -/** aggregate sum on columns */ -export type Auth_Migrations_Sum_Fields = { - __typename?: "auth_migrations_sum_fields"; - id?: Maybe; -}; - -/** update columns of table "auth.migrations" */ -export enum Auth_Migrations_Update_Column { - /** column name */ - ExecutedAt = "executed_at", - /** column name */ - Hash = "hash", - /** column name */ - Id = "id", - /** column name */ - Name = "name", -} - -export type Auth_Migrations_Updates = { - /** increments the numeric columns with given value of the filtered values */ - _inc?: InputMaybe; - /** sets the columns of the filtered rows to the given values */ - _set?: InputMaybe; - /** filter the rows which have to be updated */ - where: Auth_Migrations_Bool_Exp; -}; - -/** aggregate var_pop on columns */ -export type Auth_Migrations_Var_Pop_Fields = { - __typename?: "auth_migrations_var_pop_fields"; - id?: Maybe; -}; - -/** aggregate var_samp on columns */ -export type Auth_Migrations_Var_Samp_Fields = { - __typename?: "auth_migrations_var_samp_fields"; - id?: Maybe; -}; - -/** aggregate variance on columns */ -export type Auth_Migrations_Variance_Fields = { - __typename?: "auth_migrations_variance_fields"; - id?: Maybe; -}; - /** columns and relationships of "auth.providers" */ export type Auth_Providers = { __typename?: "auth_providers"; @@ -5346,10 +5124,6 @@ export type Mutation_Root = { delete_auth_accounts?: Maybe; /** delete single row from the table: "auth.accounts" */ delete_auth_accounts_by_pk?: Maybe; - /** delete data from the table: "auth.migrations" */ - delete_auth_migrations?: Maybe; - /** delete single row from the table: "auth.migrations" */ - delete_auth_migrations_by_pk?: Maybe; /** delete data from the table: "auth.providers" */ delete_auth_providers?: Maybe; /** delete single row from the table: "auth.providers" */ @@ -5457,10 +5231,6 @@ export type Mutation_Root = { insert_auth_accounts?: Maybe; /** insert a single row into the table: "auth.accounts" */ insert_auth_accounts_one?: Maybe; - /** insert data into the table: "auth.migrations" */ - insert_auth_migrations?: Maybe; - /** insert a single row into the table: "auth.migrations" */ - insert_auth_migrations_one?: Maybe; /** insert data into the table: "auth.providers" */ insert_auth_providers?: Maybe; /** insert a single row into the table: "auth.providers" */ @@ -5586,14 +5356,6 @@ export type Mutation_Root = { update_auth_accounts_many?: Maybe< Array> >; - /** update data of the table: "auth.migrations" */ - update_auth_migrations?: Maybe; - /** update single row of the table: "auth.migrations" */ - update_auth_migrations_by_pk?: Maybe; - /** update multiples rows of table: "auth.migrations" */ - update_auth_migrations_many?: Maybe< - Array> - >; /** update data of the table: "auth.providers" */ update_auth_providers?: Maybe; /** update single row of the table: "auth.providers" */ @@ -5805,16 +5567,6 @@ export type Mutation_RootDelete_Auth_Accounts_By_PkArgs = { id: Scalars["uuid"]["input"]; }; -/** mutation root */ -export type Mutation_RootDelete_Auth_MigrationsArgs = { - where: Auth_Migrations_Bool_Exp; -}; - -/** mutation root */ -export type Mutation_RootDelete_Auth_Migrations_By_PkArgs = { - id: Scalars["Int"]["input"]; -}; - /** mutation root */ export type Mutation_RootDelete_Auth_ProvidersArgs = { where: Auth_Providers_Bool_Exp; @@ -6104,18 +5856,6 @@ export type Mutation_RootInsert_Auth_Accounts_OneArgs = { on_conflict?: InputMaybe; }; -/** mutation root */ -export type Mutation_RootInsert_Auth_MigrationsArgs = { - objects: Array; - on_conflict?: InputMaybe; -}; - -/** mutation root */ -export type Mutation_RootInsert_Auth_Migrations_OneArgs = { - object: Auth_Migrations_Insert_Input; - on_conflict?: InputMaybe; -}; - /** mutation root */ export type Mutation_RootInsert_Auth_ProvidersArgs = { objects: Array; @@ -6506,25 +6246,6 @@ export type Mutation_RootUpdate_Auth_Accounts_ManyArgs = { updates: Array; }; -/** mutation root */ -export type Mutation_RootUpdate_Auth_MigrationsArgs = { - _inc?: InputMaybe; - _set?: InputMaybe; - where: Auth_Migrations_Bool_Exp; -}; - -/** mutation root */ -export type Mutation_RootUpdate_Auth_Migrations_By_PkArgs = { - _inc?: InputMaybe; - _set?: InputMaybe; - pk_columns: Auth_Migrations_Pk_Columns_Input; -}; - -/** mutation root */ -export type Mutation_RootUpdate_Auth_Migrations_ManyArgs = { - updates: Array; -}; - /** mutation root */ export type Mutation_RootUpdate_Auth_ProvidersArgs = { _set?: InputMaybe; @@ -7335,12 +7056,6 @@ export type Query_Root = { auth_accounts_aggregate: Auth_Accounts_Aggregate; /** fetch data from the table: "auth.accounts" using primary key columns */ auth_accounts_by_pk?: Maybe; - /** fetch data from the table: "auth.migrations" */ - auth_migrations: Array; - /** fetch aggregated fields from the table: "auth.migrations" */ - auth_migrations_aggregate: Auth_Migrations_Aggregate; - /** fetch data from the table: "auth.migrations" using primary key columns */ - auth_migrations_by_pk?: Maybe; /** fetch data from the table: "auth.providers" */ auth_providers: Array; /** fetch aggregated fields from the table: "auth.providers" */ @@ -7575,26 +7290,6 @@ export type Query_RootAuth_Accounts_By_PkArgs = { id: Scalars["uuid"]["input"]; }; -export type Query_RootAuth_MigrationsArgs = { - distinct_on?: InputMaybe>; - limit?: InputMaybe; - offset?: InputMaybe; - order_by?: InputMaybe>; - where?: InputMaybe; -}; - -export type Query_RootAuth_Migrations_AggregateArgs = { - distinct_on?: InputMaybe>; - limit?: InputMaybe; - offset?: InputMaybe; - order_by?: InputMaybe>; - where?: InputMaybe; -}; - -export type Query_RootAuth_Migrations_By_PkArgs = { - id: Scalars["Int"]["input"]; -}; - export type Query_RootAuth_ProvidersArgs = { distinct_on?: InputMaybe>; limit?: InputMaybe; @@ -9585,14 +9280,6 @@ export type Subscription_Root = { auth_accounts_by_pk?: Maybe; /** fetch data from the table in a streaming manner: "auth.accounts" */ auth_accounts_stream: Array; - /** fetch data from the table: "auth.migrations" */ - auth_migrations: Array; - /** fetch aggregated fields from the table: "auth.migrations" */ - auth_migrations_aggregate: Auth_Migrations_Aggregate; - /** fetch data from the table: "auth.migrations" using primary key columns */ - auth_migrations_by_pk?: Maybe; - /** fetch data from the table in a streaming manner: "auth.migrations" */ - auth_migrations_stream: Array; /** fetch data from the table: "auth.providers" */ auth_providers: Array; /** fetch aggregated fields from the table: "auth.providers" */ @@ -9894,32 +9581,6 @@ export type Subscription_RootAuth_Accounts_StreamArgs = { where?: InputMaybe; }; -export type Subscription_RootAuth_MigrationsArgs = { - distinct_on?: InputMaybe>; - limit?: InputMaybe; - offset?: InputMaybe; - order_by?: InputMaybe>; - where?: InputMaybe; -}; - -export type Subscription_RootAuth_Migrations_AggregateArgs = { - distinct_on?: InputMaybe>; - limit?: InputMaybe; - offset?: InputMaybe; - order_by?: InputMaybe>; - where?: InputMaybe; -}; - -export type Subscription_RootAuth_Migrations_By_PkArgs = { - id: Scalars["Int"]["input"]; -}; - -export type Subscription_RootAuth_Migrations_StreamArgs = { - batch_size: Scalars["Int"]["input"]; - cursor: Array>; - where?: InputMaybe; -}; - export type Subscription_RootAuth_ProvidersArgs = { distinct_on?: InputMaybe>; limit?: InputMaybe; @@ -11021,19 +10682,6 @@ export type Teams_Updates = { where: Teams_Bool_Exp; }; -/** Boolean expression to compare columns of type "timestamp". All fields are combined with logical 'AND'. */ -export type Timestamp_Comparison_Exp = { - _eq?: InputMaybe; - _gt?: InputMaybe; - _gte?: InputMaybe; - _in?: InputMaybe>; - _is_null?: InputMaybe; - _lt?: InputMaybe; - _lte?: InputMaybe; - _neq?: InputMaybe; - _nin?: InputMaybe>; -}; - /** Boolean expression to compare columns of type "timestamptz". All fields are combined with logical 'AND'. */ export type Timestamptz_Comparison_Exp = { _eq?: InputMaybe; diff --git a/src/graphql/schemas/hasura.json b/src/graphql/schemas/hasura.json index 4a88d10a..f726c63f 100644 --- a/src/graphql/schemas/hasura.json +++ b/src/graphql/schemas/hasura.json @@ -769,6 +769,20 @@ } }, "defaultValue": null + }, + { + "name": "schema", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null } ], "interfaces": null, diff --git a/src/hooks/useOnboarding.ts b/src/hooks/useOnboarding.ts index 02633654..a723aeed 100644 --- a/src/hooks/useOnboarding.ts +++ b/src/hooks/useOnboarding.ts @@ -27,6 +27,7 @@ import type { } from "@/types/dataSource"; import useCheckResponse from "@/hooks/useCheckResponse"; import { getSourceAndBranch } from "@/pages/Explore"; +import flattenTables from "@/utils/helpers/flattenTables"; interface Props { editId?: string; @@ -100,13 +101,7 @@ export default ({ editId }: Props) => { const onDataModelGenerationSubmit = async (data: DynamicForm) => { let tables = { ...data } as any; delete tables.type; - tables = Object.values(tables).reduce( - (acc: any, value: any) => [ - ...acc, - ...Object.keys(value).map((v) => ({ name: v })), - ], - [] - ); + tables = flattenTables(tables); if (dataSourceSetup && !branchId) { message.error(`${t("no_branch")} ${dataSourceSetup.name}`); diff --git a/src/mocks/dataSources.tsx b/src/mocks/dataSources.tsx index 8666300d..d3f4183f 100644 --- a/src/mocks/dataSources.tsx +++ b/src/mocks/dataSources.tsx @@ -133,11 +133,11 @@ export const dbTiles = [ { name: "Databricks", value: "databricks-jdbc", icon: }, { name: "Firebolt", value: "firebolt", icon: }, { name: "KSQL", value: "ksql", icon: }, - { name: "Dremio", value: "default", icon: }, - { name: "Crate", value: "default", icon: }, + { name: "Dremio", value: "dremio", icon: }, + { name: "Crate", value: "crate", icon: }, { name: "QuestDB", value: "questdb", icon: }, { name: "Snowflake", value: "snowflake", icon: }, - { name: "Materialize", value: "default", icon: }, + { name: "Materialize", value: "materialize", icon: }, { name: "Vertica", value: "vertica", icon: }, { name: "Athena", value: "athena", icon: }, { name: "Hive", value: "hive", icon: }, diff --git a/src/utils/helpers/flattenTables.ts b/src/utils/helpers/flattenTables.ts new file mode 100644 index 00000000..45a728af --- /dev/null +++ b/src/utils/helpers/flattenTables.ts @@ -0,0 +1,12 @@ +const flattenTables = (obj: any, path?: string): any[] => { + return Object.keys(obj).reduce((acc: any[], key: string) => { + const newPath = path ? `${path}.${key}` : key; + if (typeof obj[key] === "object" && obj[key] !== null) { + return [...acc, ...flattenTables(obj[key], newPath)]; + } else { + return [...acc, { schema: path, name: key }]; + } + }, []); +}; + +export default flattenTables;