From b6e1f45252ce4b438d3081962566c7f6e245ac93 Mon Sep 17 00:00:00 2001 From: Josh lloyd Date: Fri, 12 Jan 2024 15:46:16 -0700 Subject: [PATCH] addressing comments --- README.md | 4 ++-- meltano.yml | 17 ++++++++--------- tap_mysql/tap.py | 5 +++-- tests/test_core.py | 28 ---------------------------- 4 files changed, 13 insertions(+), 41 deletions(-) delete mode 100644 tests/test_core.py diff --git a/README.md b/README.md index 0d17aff..183fbe5 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,9 @@ has the following properties: | Property | Required | Default | Description | |:-------------|:--------:|:-------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------| | name | True | None | The name of the custom stream. | -| db_schemas | False | None | An array of schema names of the MySQL instance that is being queried. The same query will be run against each schema. | +| db_schemas | False | [] | An array of schema names of the MySQL instance that is being queried. The same query will be run against each schema. | | sql | True | None | The custom sql query to use for this stream. If provided, the string `{db_schema}` will be replaced with the schema name(s) from the `db_schemas` property.}` | -| primary_keys | False | None | The primary keys of the custom stream. | +| primary_keys | False | [] | The primary keys of the custom stream. | ### Configure using environment variables diff --git a/meltano.yml b/meltano.yml index 7effa76..0004a08 100644 --- a/meltano.yml +++ b/meltano.yml @@ -25,18 +25,17 @@ plugins: kind: array config: custom_streams: - - name: example_table_name + - name: example_query_name db_schemas: - - example1 - - example2 - sql: SELECT * FROM {db_schema}.filesondisk LIMIT 5 - - name: example_table_name2 + - db_schema1 + - db_schema2 + sql: SELECT * FROM {db_schema}.table1 LIMIT 5 + - name: example_query_name2 db_schemas: - - example1 - sql: SELECT * FROM example1.filesondisk LIMIT 5 + - db_schema1 + sql: SELECT * FROM db_schema1.table1 LIMIT 5 select: - - '*-example_table_name.*' - - 'example1-example_table_name2.*' + - '*-storage_snapshot.*' loaders: - name: target-jsonl variant: andyh1203 diff --git a/tap_mysql/tap.py b/tap_mysql/tap.py index 7aa49b3..a0e62eb 100644 --- a/tap_mysql/tap.py +++ b/tap_mysql/tap.py @@ -21,20 +21,21 @@ class TapMySQL(SQLTap): th.Property( "name", th.StringType, - required=False, + required=True, description="The name of the custom stream", ), th.Property( "db_schemas", th.ArrayType(th.StringType), required=False, + default=[], description="An array of schema names of the MySQL instance that is being " "queried. The same query will be run against each schema.", ), th.Property( "sql", th.StringType, - required=False, + required=True, description="The custom sql query to use for this stream. If provided, the " "string `{db_schema}` will be replaced with the schema name(s) " "from the `db_schemas` property.}`", diff --git a/tests/test_core.py b/tests/test_core.py deleted file mode 100644 index 498e2e9..0000000 --- a/tests/test_core.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Tests standard tap features using the built-in SDK tests library.""" - -# import datetime -# -# from singer_sdk.testing import get_tap_test_class -# -# from tap_mysql.tap import TapMySQL -# -# -# SAMPLE_CONFIG = { -# "host": "host_config", -# "port": "3306", -# "user": "user_config", -# "password": "password_config", -# } -# - -# Run standard built-in tap tests from the SDK: -# TestTapMySQL = get_tap_test_class( -# tap_class=TapMySQL, -# config=SAMPLE_CONFIG -# ) - - -# TODO: Create additional tests as appropriate for your tap. - -def test_nothing(): - assert True