Is there a way in the meltano supported `tap-googl...
# announcements
p
Is there a way in the meltano supported
tap-google-analytics
to pass OAuth credentials as environment variables? I don’t see anything with that in the docs.
z
Thanks for pointing this out! It seems the tap,
meltano/tap-google-analytics
supports loading the OAuth credentials via
config.json
with
oauth_credentials
but because the preinstalled
tap-google-analytics
extractor plugin doesn't list
oauth_credentials
as a valid setting, you cannot use the preinstalled plugin for passing the OAuth credentials as an environment variable. However, you can create your own Meltano extractor plugin via the cli using the existing
meltano/tap-google-analytics
repo with the settings:
Copy code
meltano add --custom extractor tap-ga-custom
namespace=ga
pip_url=git@gitlab.com:meltano/tap-google-analytics.git
executable=tap-google-analytics
capabilities=catalog,discover,state
settings=view_id,oauth_credentials,reports,start_date,end_date
Then you can add
GA_OAUTH_CREDENTIALS
to your environment and Meltano will pass it onto the tap via the
config.json
. This is untested though so there may be minor errors. We should add an issue to the Meltano repo to get the
oauth_credentials
setting added to the default plugin, if you'd like to make an issue!
y
Yes we added this feature to
tap-google-analytics
something like a year ago, before OAUTH was supported in Meltano UI, so we never exposed it to Meltano. I am pretty sure that I tested it back in the day with the oauth credentials I was generating by using my google auth script, but it should be definitely be more thoroughly tested
p
Thanks a ton! I tried this and got it working
For anyone stumbling across this, I found it a lot easier to follow this convention for specifying the sub properties of the oauth json. AWS’ serialization of the jsons was giving meltano trouble, but setting the sub properties worked like a charm https://gitlab.com/meltano/meltano/-/issues/2010
d
Thanks for filing https://gitlab.com/meltano/meltano/-/issues/2222, @zachary_wynegar, and glad you got it working @paul_blankley! For the future, note that you can always set custom settings like
oauth_credentials.access_token
even if they're not known to Meltano yet: https://meltano.com/docs/command-line-interface.html#custom-settings And for what it's worth, nested properties are documented here: https://meltano.com/docs/command-line-interface.html#nested-properties 🙂