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

made the default schema configurable #5

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ tap-mysql --about --format=markdown
| port | False | 3306 | The port number of the MySQL instance. |
| user | True | None | The username |
| password | True | None | The password for the user |
| schema | False | mysql | The default schema for the connection string. |
| custom_streams | False | None | An array of customized streams to use. |
| stream_maps | False | None | Config object for stream maps capability. For more information check out [Stream Maps](https://sdk.meltano.com/en/latest/stream_maps.html). |
| stream_map_config | False | None | User-defined config values to be used within map expressions. |
Expand Down
10 changes: 3 additions & 7 deletions meltano.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,9 @@ plugins:
custom_streams:
- name: example_query_name
db_schemas:
- db_schema1
- db_schema2
sql: SELECT * FROM {db_schema}.table1 LIMIT 5
- name: example_query_name2
db_schemas:
- db_schema1
sql: SELECT * FROM db_schema1.table1 LIMIT 5
- lloyd
- testencryptedrds
sql: SELECT '2024-07-16 00:00:00 +0:00' AS snapshot_date , ag.displayname AS asset_group_name , ag.id AS asset_group_id , SUM(fileSize) / 1024 / 1024 / 1024 AS storage_amount FROM {db_schema}.filesondisk AS f JOIN {db_schema}.assetversion AS v ON f.id = v.originalFile JOIN {db_schema}.directorasset AS d ON v.parentAsset = d.id JOIN {db_schema}.assetgroupassignments AS aga ON d.id = aga.assetId JOIN {db_schema}.assetgroups AS ag ON aga.groupId = ag.id WHERE v.dateAdded < '2024-07-16 00:00:00 +0:00' AND (d.dateRemoved IS NULL OR d.dateRemoved > '2024-07-16 00:00:00 +0:00') GROUP BY 1,2,3
select:
- '*-example_query_name.*'
loaders:
Expand Down
2 changes: 1 addition & 1 deletion tap_mysql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def get_sqlalchemy_url(cls, config: dict) -> str:
f"{config['password']}@"
f"{config['host']}:"
f"{config['port']}/"
f"mysql"
f"{config['schema']}"
)

@staticmethod
Expand Down
7 changes: 7 additions & 0 deletions tap_mysql/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ class TapMySQL(SQLTap):
secret=True,
description="The password for the user",
),
th.Property(
"schema",
th.StringType,
required=False,
default="mysql",
description="The default schema for the connection string.",
),
th.Property(
"custom_streams",
th.ArrayType(custom_stream_config),
Expand Down
Loading