Пример #1
0
 def get_metastore_params_template(cls):
     return StructFormField(
         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://&lt;host1&gt;:&lt;port1&gt;,&lt;host2&gt;:&lt;port2&gt;/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
         <a href="https://cwiki.apache.org/confluence/display/Hive/HiveServer2+Clients#HiveServer2Clients-JDBC">
             here
         </a> for more details.
     </p>""",
         ),
         username=FormField(regex="\\w+"),
         password=FormField(hidden=True),
         hms_connection=ExpandableFormField(
             of=FormField(
                 required=True,
                 description="Put url to hive metastore server here"),
             min=1,
         ),
     )
 def get_metastore_params_template(cls):
     return StructFormField(
         catalog_id=FormField(
             required=True,
             description="Enter the Glue Data Catalog ID",
             regex=r"^\d{12}$",
         ),
         region=FormField(required=True,
                          description="Enter the AWS Region"),
         load_partitions=load_partitions_field,
     )
Пример #3
0
 def get_metastore_params_template(cls):
     return StructFormField(
         hms_connection=ExpandableFormField(
             of=FormField(
                 required=True,
                 description="Put url to hive metastore server here",
                 field_type=FormFieldType.String,
             ),
             min=1,
         ),
         load_partitions=load_partitions_field,
     )
Пример #4
0
 def export_form(self):
     return StructFormField(
         sheet_url=FormField(
             description="Optional, if not provided a new sheet will be created."
         ),
         worksheet_title=FormField(
             description='Defaults to "Sheet1"',
             helper="Title of the worksheet, if not found then a sheet will be created",
         ),
         start_cell=FormField(
             description="The top left cell position where data will be filled. Defaults to A1",
             regex="^[A-Z]{1,3}[1-9][0-9]*$",
         ),
     )
Пример #5
0
 def get_metastore_params_template(cls):
     return StructFormField(
         catalog_id=FormField(
             required=True,
             description="Enter the Glue Data Catalog ID",
             regex=r"^\d{12}$",
         ),
         region=FormField(required=True,
                          description="Enter the AWS Region"),
         load_partitions=FormField(
             required=False,
             field_type=FormFieldType.Boolean,
             helper=
             """In case your data catalog is large, loading all partitions for all tables can be quite time consuming.
             Skipping partition information can reduce your metastore refresh latency
             """,
         ),
     )
Пример #6
0
 def test_dict_field(self):
     form = StructFormField(
         name=FormField(),
         phone_numbers=ExpandableFormField(of=FormField(), min=1, max=2),
     )
     self.assertEqual(
         validate_form(form, "123"),
         (False, "Field value is not a dictionary"),
     )
     self.assertEqual(
         validate_form(form, {
             "phone_numbers": [1234],
             "name": "bob"
         }),
         (False, "Field value is not a string"),
     )
     self.assertEqual(
         validate_form(form, {
             "phone_numbers": ["1234"] * 3,
             "name": "bob"
         }),
         (False, "Field value more than allowed length"),
     )
     self.assertEqual(
         validate_form(form, {
             "phone_numbers": ["1234"],
             "name": "bob"
         }),
         (True, ""),
     )
     self.assertEqual(
         validate_form(
             form,
             {
                 "phone_numbers": ["1234"],
             },
         ),
         (True, ""),
     )
Пример #7
0
 def get_metastore_params_template(cls):
     return StructFormField(connection_string=FormField(
         required=True,
         description="Put sqlalchemy connection string here"), )
Пример #8
0
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"),
    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://&lt;host1&gt;:&lt;port1&gt;,&lt;host2&gt;:&lt;port2&gt;/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),
)

presto_executor_template = StructFormField(
    connection_string=FormField(
        required=True,
        regex=
        "^(?:jdbc:)?presto:\\/\\/([\\w.-]+(?:\\:\\d+)?(?:,[\\w.-]+(?:\\:\\d+)?)*)(\\/\\w+)?(\\/\\w+)?(\\?[\\w.-]+=[\\w.-]+(?:&[\\w.-]+=[\\w.-]+)*)?$",  # noqa: E501
        helper="""
<p>Format jdbc:presto://&lt;host:port&gt;/&lt;catalog&gt;/&lt;schema&gt;?presto_conf_list</p>
Пример #9
0
 def dag_exporter_meta(self):
     return StructFormField(
         title=FormField(description="dag title"),
         description=FormField(description="dag description"),
     )