Skip to content
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

feat: Data Connectors (SQL) #766

Open
wants to merge 148 commits into
base: main
Choose a base branch
from
Open

feat: Data Connectors (SQL) #766

wants to merge 148 commits into from

Conversation

davidkircos
Copy link
Collaborator

@davidkircos davidkircos commented Nov 4, 2023

Goals
Add a SQL connection
Support Postgres, MySQL
Connection Code Editor
Run code to get data in sheet
Basic schema viewer

Client

  • List connections @jimniels
  • Create a connection @jimniels
  • Test a connection @jimniels @ddimaria
  • Edit a connection @jimniels
    • Done but has security considerations, like which fields are editable based on being sensitive vs. not
  • Delete a connection
    • We'll have to handle the lifecycle of a connection, e.g. somebody adds a connection to a file, runs a query, then later deletes that connection so when you run the query again, what should the user see?
  • Select a connection in cell type menu @jimniels
  • Code editor connection
  • Pull data
  • Display schema
  • Fix all TODO: (connections) in the PR
  • Add mix panel events where it makes sense for connection-related interactions

Core

API

  • Endpoints for creating, retrieving, and editing connections @jimniels
    • POST /connections for { type: 'postgres' } or { type: 'mysql' }
    • GET /connections
    • GET /connections/:uuid (TODO: should not return sensitive info)
    • PUT /connections/:uuid
    • GET /internal/user/:auth0Id/connections/:uuid (returns sensitive info)
  • Permissions for connections
  • Tests for above endpoints
  • [blocked] Securely store credentials @davidkircos
  • Security considerations for sending sensitive info vs. non-sensitive info

Connections Service

  • Create connections service (@ddimaria) Axium, Docker, Etc [ similar to Files and Multiplayer ]
  • Endpoint for testing connection - Postgres
  • Endpoint for retrieving data - fetch credentials from API - Postgres
  • Postgres support for schema retrieval
  • Mysql support for testing, querying and schema retrieval
  • Add supported databases to docker and include in tests

Deployment

  • Static IP for server so people can whitelist
  • Create/publish docs for connections

Copy link

vercel bot commented Nov 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quadratic ❌ Failed (Inspect) May 23, 2024 11:05pm

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 November 4, 2023 19:52 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 November 4, 2023 22:22 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 November 6, 2023 23:51 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 November 8, 2023 23:25 Inactive
@jimniels jimniels added the high priority within weeks label Nov 9, 2023
Base automatically changed from next to main November 13, 2023 19:06
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 November 13, 2023 21:56 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 November 14, 2023 00:14 Inactive
src/gridGL/UI/Cursor.ts Outdated Show resolved Hide resolved
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 November 14, 2023 00:40 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 May 23, 2024 20:22 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 May 23, 2024 20:47 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 May 23, 2024 21:00 Inactive
@@ -1,7 +1,8 @@
// This file is automatically generated by quadratic-core/src/bin/export_types.rs
// Do not modify it manually.

export type CodeCellLanguage = "Python" | "Formula";
export type CodeCellLanguage = "Python" | "Formula" | { "Connection": { kind: ConnectionKind, id: string, } };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ddimaria minor, but can we rename id to uuid? It is a UUID string and that's how it's represented in the API, so it makes the client code a bit more uniform when we're working with this, e.g.

connectionsFromApi.find(connection => connection.uuid === editorInteractionState.mode?.Connection?.uuid)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we refer to the kind as type in the API as well, might be worth aligning on this language as wel...

Copy link
Collaborator

@ddimaria ddimaria May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rustland used kind instead of type b/c type is a reserved word. I can look into rewriting during serialization.

I have a small opinion about not changing id to uuid (seems like a database antipattern to have two unique identifiers...a UUID type in Postgres is idiomatic for the PK, I think we use the id as an index or ordering mechanism?). Also, calling it a uuid feels a bit like Hungarian notation.

@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 May 23, 2024 21:31 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 May 23, 2024 21:42 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 May 23, 2024 22:17 Inactive
@davidkircos davidkircos temporarily deployed to quadratic-api-dev-pr-766 May 23, 2024 22:58 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed high priority within weeks type: enhancement new feature or request
Projects
Status: Building
Development

Successfully merging this pull request may close these issues.

None yet

5 participants