Skip to content

Commit

Permalink
made the default schema configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
jlloyd-widen committed Jul 17, 2024
1 parent 3a46883 commit 8c06375
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
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

0 comments on commit 8c06375

Please sign in to comment.