appsmithorg / appsmith

Platform to build admin panels, internal tools, and dashboards. Integrates with 25+ databases and any API.
https://www.appsmith.com
Apache License 2.0
34.08k stars 3.68k forks source link

[Feature]: Add support for creating datasources by importing connection strings #27518

Open GreenFlux opened 1 year ago

GreenFlux commented 1 year ago

Is there an existing issue for this?

Summary

Currently Appsmith only supports connection strings for creating MongoDB datasources. This feature request is for a new Connection String Importer to be added at the top level in the Create Datasource list, rather than add a string importer input to each separate datasource form.

This would be similar to the curl importer, and would be an intermediate form, before landing on the actual datasource form. It should be able to test the string to ensure it is valid for the given protocol, and if valid, create a new draft datasource of the correct type, with all values filled in.

Why should this be worked on?

This library may be helpful in parsing DB URLs: https://npm.runkit.com/parse-database-url

@GreenFlux has provided regex for various DBs here .

Screenshot 2023-09-27 at 6 35 15 AM

mysql://(?<username>[^:]+):(?<password>[^@]+)@(?<hostname>[^:/]+):(?<port>\d+)/(?<database_name>.+)

mssql://(?<username>[^:]+):(?<password>[^@]+)@(?<hostname>[^:/]+):(?<port>\d+)/(?<database_name>.+)

postgresql://(?<username>[^:]+):(?<password>[^@]+)@(?<hostname>[^:/]+):(?<port>\d+)/(?<database_name>.+)

oracle://(?<username>[^:]+):(?<password>[^@]+)@(?<hostname>[^:/]+):(?<port>\d+)/(?<database_name>.+)

redshift://(?<username>[^:]+):(?<password>[^@]+)@(?<hostname>[^:/]+):(?<port>\d+)/(?<database_name>.+)

redis://:(?<password>[^@]+)@(?<hostname>[^:/]+):(?<port>\d+)

snowflake://(?<username>[^:]+):(?<password>[^@]+)@(?<hostname>[^:/]+)

firestore://(?<project_id>.+)

elasticsearch://(?<username>[^:]+):(?<password>[^@]+)@(?<hostname>[^:/]+):(?<port>\d+)
GreenFlux commented 1 year ago

cc @rlnorthcutt @sumitsum

GreenFlux commented 1 year ago

I could contribute a regex to go with each protocol if it helps. I could use named groups so each form input is matched and labeled in the output.

sumitsum commented 1 year ago

Hi @GreenFlux thanks for offering the help. If possible, can you please create a document with various regex and share the link here ?

GreenFlux commented 1 year ago

@sumitsum , will do. I can have this for you early next week.