-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make struct form fields ordered (#1181)
- Loading branch information
Showing
11 changed files
with
171 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 71 additions & 43 deletions
114
querybook/server/lib/query_executor/executor_template/templates.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,118 @@ | ||
from lib.form import FormField, StructFormField, FormFieldType, ExpandableFormField | ||
|
||
hive_executor_template = StructFormField( | ||
hive_resource_manager=FormField( | ||
description="Provide resource manager link here to provide insights" | ||
( | ||
"hive_resource_manager", | ||
FormField(description="Provide resource manager link here to provide insights"), | ||
), | ||
connection_string=FormField( | ||
required=True, | ||
description="Put your JDBC connection string here", | ||
regex="^(?:jdbc:)?hive2:\\/\\/([\\w.-]+(?:\\:\\d+)?(?:,[\\w.-]+(?:\\:\\d+)?)*)\\/(\\w*)((?:;[\\w.-]+=[\\w.-]+)*)(\\?[\\w.-]+=[\\w.-]+(?:;[\\w.-]+=[\\w.-]+)*)?(\\#[\\w.-]+=[\\w.-]+(?:;[\\w.-]+=[\\w.-]+)*)?$", # noqa: E501 | ||
helper=""" | ||
( | ||
"connection_string", | ||
FormField( | ||
required=True, | ||
description="Put your JDBC connection string here", | ||
regex="^(?:jdbc:)?hive2:\\/\\/([\\w.-]+(?:\\:\\d+)?(?:,[\\w.-]+(?:\\:\\d+)?)*)\\/(\\w*)((?:;[\\w.-]+=[\\w.-]+)*)(\\?[\\w.-]+=[\\w.-]+(?:;[\\w.-]+=[\\w.-]+)*)?(\\#[\\w.-]+=[\\w.-]+(?:;[\\w.-]+=[\\w.-]+)*)?$", # noqa: E501 | ||
helper=""" | ||
<p> | ||
Format | ||
jdbc:hive2://<host1>:<port1>,<host2>:<port2>/dbName;sess_var_list?hive_conf_list#hive_var_list | ||
</p> | ||
<p>Currently support zookeeper in session var, and will pass any conf variables to HS2</p> | ||
<p>See [here](https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients#HiveServer2Clients-JDBC) for more details. | ||
</p>""", | ||
), | ||
), | ||
username=FormField(regex="\\w+"), | ||
password=FormField(hidden=True), | ||
impersonate=FormField(field_type=FormFieldType.Boolean), | ||
("username", FormField(regex="\\w+")), | ||
("password", FormField(hidden=True)), | ||
("impersonate", FormField(field_type=FormFieldType.Boolean)), | ||
) | ||
|
||
presto_executor_template = StructFormField( | ||
connection_string=FormField( | ||
required=True, | ||
regex="^(?:jdbc:)?presto:\\/\\/([\\w.-]+(?:\\:\\d+)?(?:,[\\w.-]+(?:\\:\\d+)?)*)(\\/\\w+)?(\\/\\w+)?(\\?[\\w]+=[^&]+(?:&[\\w]+=[^&]+)*)?$", # noqa: E501 | ||
helper=""" | ||
( | ||
"connection_string", | ||
FormField( | ||
required=True, | ||
regex="^(?:jdbc:)?presto:\\/\\/([\\w.-]+(?:\\:\\d+)?(?:,[\\w.-]+(?:\\:\\d+)?)*)(\\/\\w+)?(\\/\\w+)?(\\?[\\w]+=[^&]+(?:&[\\w]+=[^&]+)*)?$", # noqa: E501 | ||
helper=""" | ||
<p>Format jdbc:presto://<host:port>/<catalog>/<schema>?presto_conf_list</p> | ||
<p>Catalog and schema are optional. We only support SSL as the conf option.</p> | ||
<p>See [here](https://prestodb.github.io/docs/current/installation/jdbc.html) for more details.</p>""", | ||
), | ||
), | ||
username=FormField(regex="\\w+"), | ||
password=FormField(hidden=True), | ||
impersonate=FormField(field_type=FormFieldType.Boolean), | ||
proxy_user_id=FormField( | ||
field_type=FormFieldType.String, | ||
helper=""" | ||
("username", FormField(regex="\\w+")), | ||
("password", FormField(hidden=True)), | ||
("impersonate", FormField(field_type=FormFieldType.Boolean)), | ||
( | ||
"proxy_user_id", | ||
FormField( | ||
field_type=FormFieldType.String, | ||
helper=""" | ||
<p>User field used as proxy_user. proxy_user will be forwaded to Presto as the session user.</p> | ||
<p>Defaults to username. Possible values are username, email, fullname </p> | ||
<p>See [here](https://prestodb.github.io/docs/current/installation/jdbc.html) for more details.</p>""", | ||
), | ||
), | ||
) | ||
|
||
trino_executor_template = StructFormField( | ||
connection_string=FormField( | ||
required=True, | ||
regex="^(?:jdbc:)?trino:\\/\\/([\\w.-]+(?:\\:\\d+)?(?:,[\\w.-]+(?:\\:\\d+)?)*)(\\/\\w+)?(\\/\\w+)?(\\?[\\w]+=[^&]+(?:&[\\w]+=[^&]+)*)?$", # noqa: E501 | ||
helper=""" | ||
( | ||
"connection_string", | ||
FormField( | ||
required=True, | ||
regex="^(?:jdbc:)?trino:\\/\\/([\\w.-]+(?:\\:\\d+)?(?:,[\\w.-]+(?:\\:\\d+)?)*)(\\/\\w+)?(\\/\\w+)?(\\?[\\w]+=[^&]+(?:&[\\w]+=[^&]+)*)?$", # noqa: E501 | ||
helper=""" | ||
<p>Format jdbc:trino://<host:port>/<catalog>/<schema>?trino_conf_list</p> | ||
<p>Catalog and schema are optional. We only support SSL as the conf option.</p> | ||
<p>See [here](https://trino.io/docs/current/installation/jdbc.html) for more details.</p>""", | ||
), | ||
), | ||
username=FormField(required=True, regex="\\w+"), | ||
impersonate=FormField(field_type=FormFieldType.Boolean), | ||
proxy_user_id=FormField( | ||
field_type=FormFieldType.String, | ||
helper=""" | ||
("username", FormField(regex="\\w+")), | ||
("impersonate", FormField(field_type=FormFieldType.Boolean)), | ||
( | ||
"proxy_user_id", | ||
FormField( | ||
field_type=FormFieldType.String, | ||
helper=""" | ||
<p>User field used as proxy_user. proxy_user will be forwaded to Trino as the session user.</p> | ||
<p>Defaults to username. Possible values are username, email, fullname </p> | ||
<p>See [here](https://trino.io/docs/current/installation/jdbc.html) for more details.</p>""", | ||
), | ||
), | ||
) | ||
|
||
sqlalchemy_template = StructFormField( | ||
connection_string=FormField( | ||
required=True, | ||
helper=""" | ||
( | ||
"connection_string", | ||
FormField( | ||
required=True, | ||
helper=""" | ||
<p> | ||
See [here](https://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls) for more details. | ||
</p>""", | ||
), | ||
), | ||
connect_args=ExpandableFormField( | ||
of=StructFormField( | ||
key=FormField(required=True), | ||
value=FormField(required=True), | ||
isJson=FormField( | ||
field_type=FormFieldType.Boolean, | ||
helper="If true, then the value will be parsed as JSON", | ||
), | ||
) | ||
( | ||
"connect_args", | ||
ExpandableFormField( | ||
of=StructFormField( | ||
("key", FormField(required=True)), | ||
("value", FormField(required=True)), | ||
( | ||
"isJson", | ||
FormField( | ||
field_type=FormFieldType.Boolean, | ||
helper="If true, then the value will be parsed as JSON", | ||
), | ||
), | ||
) | ||
), | ||
), | ||
) | ||
|
||
bigquery_template = StructFormField( | ||
google_credentials_json=FormField( | ||
helper="The JSON string used to log in as service account. If not provided then **GOOGLE_CREDS** from settings will be used.", | ||
( | ||
"google_credentials_json", | ||
FormField( | ||
helper="The JSON string used to log in as service account. If not provided then **GOOGLE_CREDS** from settings will be used.", | ||
), | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.