Comments (6)
Couldn't you do:
echo '{"host": "mysql-host.com", \
"port": "3306", \
"user": "$USR_PROD", \
"password": "$PWD_PROD"}'
> /tmp/my_config; \
tap-mysql --config /tmp/my_config
from singer-python.
I totally can (at least in my use case). My suggestion was more about the convenience of it. When I have to do that inside an Airflow BashOperator
for example, it starts looking odd
BashOperator(
task_id='syn_animals',
bash_command="""
echo '{"host": "mysql-host.com", \
"port": "3306", \
"user": "$USR_PROD", \
"password": "$PWD_PROD"}'
> /tmp/my_config;
tap-mysql --config /tmp/my_config
"""
)
Also I might not have a good place (or a safe place) to put that temporal config file.
In this custom tap I experimented with an optional parameter --overrides
which accepts a JSON string that gets merged into a default (or empty otherwise) configuration file. That would also work here.
BashOperator(
task_id='syn_animals',
bash_command="""
tap-mysql --overrides '{"host": "mysql-host.com", "port": "3306", "user": "$USR_PROD", "password": "$PWD_PROD"}'
"""
)
But again it's just a matter of convenience :)
from singer-python.
Understood, feel free to open a PR for the feature 👍
On another note, how do you handle state files? Or do you not use those?
from singer-python.
Great. Will do that :)
No, I do not need state files. But if I were to implement that, what's wrong with using the same approach? So
BashOperator(
task_id='syn_animals',
bash_command="""
tap-mysql \
--config ~/.singer.io/tap_mysql_defaults.json \ # staging and prod configuration is identical, only the host changes
--overrides '{"host": "$MYSQL_HOST"}' \
--state '{"type": "STATE", "value": {"bookmarks": {"db-animals": {"version": 1509135204169, "replication_key_value": "{{ ts }}", "replication_key": "updated_at"}}, "currently_syncing": null}}' \
| target-redshift ...
"""
)
from singer-python.
Nothing wrong with it 😄 It occurred to me that either you are not using state at all or we would have to also implement this for state
from singer-python.
Right. I sent a PR that implements this behavior in the load_json
function from the utils
, so it should work for config
, state
and properties
arguments.
from singer-python.
Related Issues (20)
- Incompatible taps & targets HOT 4
- `log_debug` cannot work...for very long HOT 3
- Bump pytz version to >= 2018.9 HOT 1
- Ratelimit helper does not support multi-threading or async
- Schema fails to be turned into dictionary if it contains "anyOf"
- 5.9.0: Transformer.filter_data_by_metadata() doesn't filter unselected nodes where selected unspecified HOT 1
- Feature Request: Add support for --stream_name argument HOT 1
- Messages are not valid JSON
- Transformer dumps JSON incompatible string
- Async support
- JSONSchema Draft 7 array Tuple Validation unsupported? Schema.from_dict() raise exception HOT 1
- Add UTF-8 validity checking to schema
- Support Draft 7 validation keys in object schemas
- --catalog vs -p (properties) parameters HOT 4
- Loosen version spec in setup.py HOT 4
- `utils.strptime` and `utils.strftime` are asymmetrical HOT 7
- use singer taps and targets programatically HOT 5
- Invalid format string %04Y on Windows HOT 8
- Is requirement for backoff==1.3.2 necessary HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from singer-python.