Skip to content

Create connector files #7726

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 21 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 10 additions & 39 deletions runtime/drivers/athena/athena.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,56 +34,27 @@ var spec = drivers.Spec{
DocsURL: "https://docs.rilldata.com/reference/connectors/athena",
ConfigProperties: []*drivers.PropertySpec{
{
Key: "aws_access_key_id",
Type: drivers.StringPropertyType,
Secret: true,
Key: "aws_access_key_id",
Type: drivers.StringPropertyType,
DisplayName: "AWS access key ID",
Description: "AWS access key ID",
Required: true,
Secret: true,
},
{
Key: "aws_secret_access_key",
Type: drivers.StringPropertyType,
Secret: true,
},
},
// Important: Any edits to the below properties must be accompanied by changes to the client-side form validation schemas.
SourceProperties: []*drivers.PropertySpec{
{
Key: "sql",
Key: "aws_secret_access_key",
Type: drivers.StringPropertyType,
DisplayName: "AWS secret access key",
Description: "AWS secret access key",
Required: true,
DisplayName: "SQL",
Description: "Query to extract data from Athena.",
Placeholder: "select * from catalog.table;",
Secret: true,
},
{
Key: "output_location",
Type: drivers.StringPropertyType,
DisplayName: "S3 output location",
Description: "An output location for query result is required either through the workgroup result configuration setting or set here.",
Placeholder: "s3://bucket-name/path/",
Required: false,
},
{
Key: "workgroup",
Type: drivers.StringPropertyType,
DisplayName: "AWS Athena workgroup",
Description: "AWS Athena workgroup to use for queries. Default is primary",
Placeholder: "primary",
Required: false,
},
{
Key: "region",
Type: drivers.StringPropertyType,
DisplayName: "AWS region",
Description: "AWS region to connect to Athena and the output location.",
Placeholder: "us-east-1",
Required: false,
},
{
Key: "name",
Type: drivers.StringPropertyType,
DisplayName: "Source name",
Description: "The name of the source",
Placeholder: "my_new_source",
Required: true,
},
},
Expand Down
43 changes: 6 additions & 37 deletions runtime/drivers/bigquery/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,53 +28,22 @@ var spec = drivers.Spec{
DocsURL: "https://docs.rilldata.com/reference/connectors/bigquery",
ConfigProperties: []*drivers.PropertySpec{
{
Key: "google_application_credentials",
Type: drivers.FilePropertyType,
Hint: "Enter path of file to load from.",
Key: "google_application_credentials",
Type: drivers.InformationalPropertyType,
DisplayName: "GCP credentials",
Description: "GCP credentials inferred from your local environment.",
Hint: "Set your local credentials: <code>gcloud auth application-default login</code> Click to learn more.",
DocsURL: "https://docs.rilldata.com/reference/connectors/gcs#local-credentials",
},
{
Key: "project_id",
Type: drivers.StringPropertyType,
Required: false,
DisplayName: "Project ID",
Description: "Default Google project ID.",
},
},
// Important: Any edits to the below properties must be accompanied by changes to the client-side form validation schemas.
SourceProperties: []*drivers.PropertySpec{
{
Key: "sql",
Type: drivers.StringPropertyType,
Required: true,
DisplayName: "SQL",
Description: "Query to extract data from BigQuery.",
Placeholder: "select * from project.dataset.table;",
},
{
Key: "project_id",
Type: drivers.StringPropertyType,
Required: true,
DisplayName: "Project ID",
Description: "Google project ID.",
Placeholder: "my-project",
Hint: "Rill will use the project ID from your local credentials, unless set here. Set this if no project ID configured in credentials.",
},
{
Key: "name",
Type: drivers.StringPropertyType,
DisplayName: "Source name",
Description: "The name of the source",
Placeholder: "my_new_source",
Required: true,
},
{
Key: "google_application_credentials",
Type: drivers.InformationalPropertyType,
DisplayName: "GCP credentials",
Description: "GCP credentials inferred from your local environment.",
Hint: "Set your local credentials: <code>gcloud auth application-default login</code> Click to learn more.",
DocsURL: "https://docs.rilldata.com/reference/connectors/gcs#local-credentials",
},
},
ImplementsWarehouse: true,
}
Expand Down
18 changes: 1 addition & 17 deletions runtime/drivers/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,16 @@ var spec = drivers.Spec{
},
// Important: Any edits to the below properties must be accompanied by changes to the client-side form validation schemas.
SourceProperties: []*drivers.PropertySpec{
{
Key: "sql",
Type: drivers.StringPropertyType,
Required: true,
DisplayName: "SQL",
Description: "Query to extract data from MySQL.",
Placeholder: "select * from table;",
},
{
Key: "dsn",
Type: drivers.StringPropertyType,
DisplayName: "MySQL Connection String",
Required: false,
Required: true,
DocsURL: "https://dev.mysql.com/doc/refman/8.4/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri",
Placeholder: "mysql://user:password@host:3306/my-db",
Hint: "Can be configured here or by setting the 'connector.mysql.dsn' environment variable (using '.env' or '--env')",
Secret: true,
},
{
Key: "name",
Type: drivers.StringPropertyType,
DisplayName: "Source name",
Description: "The name of the source",
Placeholder: "my_new_source",
Required: true,
},
},
ImplementsSQLStore: true,
}
Expand Down
18 changes: 1 addition & 17 deletions runtime/drivers/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,16 @@ var spec = drivers.Spec{
},
// Important: Any edits to the below properties must be accompanied by changes to the client-side form validation schemas.
SourceProperties: []*drivers.PropertySpec{
{
Key: "sql",
Type: drivers.StringPropertyType,
Required: true,
DisplayName: "SQL",
Description: "Query to extract data from Postgres.",
Placeholder: "select * from table;",
},
{
Key: "database_url",
Type: drivers.StringPropertyType,
DisplayName: "Postgres Connection String",
Required: false,
Required: true,
DocsURL: "https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING",
Placeholder: "postgresql://postgres:postgres@localhost:5432/postgres",
Hint: "Can be configured here or by setting the 'connector.postgres.database_url' environment variable (using '.env' or '--env')",
Secret: true,
},
{
Key: "name",
Type: drivers.StringPropertyType,
DisplayName: "Source name",
Description: "The name of the source",
Placeholder: "my_new_source",
Required: true,
},
},
ImplementsSQLStore: true,
}
Expand Down
79 changes: 34 additions & 45 deletions runtime/drivers/redshift/redshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,20 @@ var spec = drivers.Spec{
DocsURL: "https://docs.rilldata.com/reference/connectors/redshift",
ConfigProperties: []*drivers.PropertySpec{
{
Key: "aws_access_key_id",
Type: drivers.StringPropertyType,
Secret: true,
},
{
Key: "aws_secret_access_key",
Type: drivers.StringPropertyType,
Secret: true,
},
},
// Important: Any edits to the below properties must be accompanied by changes to the client-side form validation schemas.
SourceProperties: []*drivers.PropertySpec{
{
Key: "sql",
Key: "aws_access_key_id",
Type: drivers.StringPropertyType,
DisplayName: "AWS access key ID",
Description: "AWS access key ID",
Required: true,
DisplayName: "SQL",
Description: "Query to extract data from Redshift.",
Placeholder: "select * from public.table;",
Secret: true,
},
{
Key: "output_location",
Key: "aws_secret_access_key",
Type: drivers.StringPropertyType,
DisplayName: "S3 output location",
Description: "Output location in S3 for temporary data.",
Placeholder: "s3://bucket-name/path/",
DisplayName: "AWS secret access key",
Description: "AWS secret access key",
Required: true,
Secret: true,
},
{
Key: "workgroup",
Expand All @@ -83,31 +70,33 @@ var spec = drivers.Spec{
Placeholder: "dev",
Required: true,
},
{
Key: "cluster_identifier",
Type: drivers.StringPropertyType,
DisplayName: "Redshift cluster identifier",
Description: "Redshift cluster identifier",
Placeholder: "redshift-cluster-1",
Required: false,
},
{
Key: "role_arn",
Type: drivers.StringPropertyType,
DisplayName: "Redshift role ARN",
Description: "Redshift role ARN",
Placeholder: "arn:aws:iam::03214372:role/service-role/AmazonRedshift-CommandsAccessRole-20240307T203902",
Required: true,
},
{
Key: "name",
Type: drivers.StringPropertyType,
DisplayName: "Source name",
Description: "The name of the source",
Placeholder: "my_new_source",
Required: true,
},
},
// SourceProperties: []*drivers.PropertySpec{
// {
// Key: "output_location",
// Type: drivers.StringPropertyType,
// DisplayName: "S3 output location",
// Description: "Output location in S3 for temporary data.",
// Placeholder: "s3://bucket-name/path/",
// Required: true,
// },
// {
// Key: "cluster_identifier",
// Type: drivers.StringPropertyType,
// DisplayName: "Redshift cluster identifier",
// Description: "Redshift cluster identifier",
// Placeholder: "redshift-cluster-1",
// Required: false,
// },
// {
// Key: "role_arn",
// Type: drivers.StringPropertyType,
// DisplayName: "Redshift role ARN",
// Description: "Redshift role ARN",
// Placeholder: "arn:aws:iam::03214372:role/service-role/AmazonRedshift-CommandsAccessRole-20240307T203902",
// Required: true,
// },
// },
ImplementsWarehouse: true,
}

Expand Down
38 changes: 10 additions & 28 deletions web-common/src/features/sources/modal/AddDataModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,13 @@
import DuplicateSource from "./DuplicateSource.svelte";
import LocalSourceUpload from "./LocalSourceUpload.svelte";
import RequestConnectorForm from "./RequestConnectorForm.svelte";
import { OLAP_ENGINES, SORT_ORDER, SOURCES } from "./constants";

let step = 0;
let selectedConnector: null | V1ConnectorDriver = null;
let requestConnector = false;
let isSubmittingForm = false;

const SOURCES = [
"gcs",
"s3",
"azure",
"bigquery",
"athena",
"redshift",
"duckdb",
"motherduck",
"postgres",
"mysql",
"sqlite",
"snowflake",
"salesforce",
"local_file",
"https",
];

const OLAP_CONNECTORS = ["clickhouse", "druid", "pinot"];

const SORT_ORDER = [...SOURCES, ...OLAP_CONNECTORS];

const ICONS = {
gcs: GoogleCloudStorage,
s3: AmazonS3,
Expand Down Expand Up @@ -96,10 +75,10 @@
data.connectors &&
data.connectors
.filter(
// Only show connectors in SOURCES or OLAP_CONNECTORS
// Only show connectors in SOURCES or OLAP_ENGINES
(a) =>
a.name &&
(SOURCES.includes(a.name) || OLAP_CONNECTORS.includes(a.name)),
(SOURCES.includes(a.name) || OLAP_ENGINES.includes(a.name)),
)
.sort(
// CAST SAFETY: we have filtered out any connectors that
Expand Down Expand Up @@ -173,6 +152,11 @@
$: isModelingSupportedForDefaultOlapDriver =
useIsModelingSupportedForDefaultOlapDriver($runtime.instanceId);
$: isModelingSupported = $isModelingSupportedForDefaultOlapDriver.data;

$: isConnectorType =
selectedConnector?.implementsOlap ||
selectedConnector?.implementsSqlStore ||
selectedConnector?.implementsWarehouse;
</script>

{#if step >= 1 || $duplicateSourceName}
Expand Down Expand Up @@ -221,7 +205,7 @@
<Dialog.Title>Connect an OLAP engine</Dialog.Title>

<div class="connector-grid">
{#each connectors?.filter((c) => c.name && OLAP_CONNECTORS.includes(c.name)) as connector (connector.name)}
{#each connectors?.filter((c) => c.name && OLAP_ENGINES.includes(c.name)) as connector (connector.name)}
{#if connector.name}
<button
id={connector.name}
Expand Down Expand Up @@ -276,9 +260,7 @@
{:else if selectedConnector.name}
<AddDataForm
connector={selectedConnector}
formType={OLAP_CONNECTORS.includes(selectedConnector.name)
? "connector"
: "source"}
formType={isConnectorType ? "connector" : "source"}
onClose={resetModal}
onBack={back}
on:submitting={handleSubmittingChange}
Expand Down
Loading