```(.venv) manigovindarajulu@Manis-MBP ga360 % mel...
# announcements
m
Copy code
(.venv) manigovindarajulu@Manis-MBP ga360 % meltano --log-level=info elt tap-ga360 target-jsonl --job_id=ga360_json11
meltano      | Running extract & load...
meltano      | No state was found, complete import.
meltano      | Extract & load complete!
meltano      | Transformation skipped.
d
@mani The fact that you're not seeing any log messages coming from
tap-ga360
suggests that the catalog file Meltano is generating doesn't contain any streams marked as
selected
, since we would otherwise see a
Syncing stream: <stream>
message for each selected stream: https://github.com/singer-io/tap-ga360/blob/master/tap_ga360/__init__.py#L20 Do you see any "Selected attributes" when you run
meltano select --list tap-ga360
?
m
Thanks @douwe_maan, I am new to python,singer,meltano, what should i do to proceed further. Please advise, Here is the o/p
(.venv) manigovindarajulu@Manis-MBP ga360 % meltano select --list tap-ga360
Cannot list the selected attributes: Extractor ‘tap-ga360’ does not support catalog discovery (the
discover
capability is not advertised)
d
@mani Ah, I think we've found the issue then! The tap does actually support catalog discovery (the
--discover
flag): https://github.com/singer-io/tap-ga360/blob/master/tap_ga360/__init__.py#L77, but Meltano currently thinks it doesn't (as indicated by your error message), so it's not actually discovering and generating a catalog, and not passing a
--catalog
flag to the tap, so
parsed_args.catalog
is unset, and the tap never makes it to this line: https://github.com/singer-io/tap-ga360/blob/master/tap_ga360/__init__.py#L79 To fix this, we should tell Meltano that your custom tap actually does support the
discover
and
catalog
capabilities
, as well as
state
. Can you add them to your plugin definition in
meltano.yml
and try running
meltano select --list tap-ga360
again?
m
Thanks, I’ve added, but I am getting some other errors`TION_PATH': 'output', 'MELTANO_LOAD_DESTINATION_PATH': 'output', 'TARGET_JSONL_DO_TIMESTAMP_FILE': 'true', 'MELTANO_LOAD_DO_TIMESTAMP_FILE': 'true', 'TARGET_JSONL__DIALECT': 'target_jsonl', 'MELTANO_LOAD__DIALECT': 'target_jsonl'}` tap-ga360     | INFO Syncing stream:ga_sessions tap-ga360 (out)  | {“type”: “SCHEMA”, “stream”: “ga_sessions”, “schema”: {“type”: [“null”, “object”], “properties”: {“visitNumber”: {“type”: [“null”, “number”]}, “customDimensions”: {“type”: [“null”, “array”], “items”: {“type”: [“null”, “object”], “properties”: {“value”: {“type”: [“null”, “string”]}, “index”: {“type”: [“null”, “number”]}}}}, “userId”: {“type”: [“null”, “string”]}, “clientId”: {“type”: [“null”, “string”]}, “visitId”: {“type”: [“null”, “number”]}, “date”: {“type”: [“null”, “string”], “format”: “date-time”}, “visitStartTime”: {“type”: [“null”, “number”]}, “totals”: {“type”: [“null”, “object”], “properties”: {“timeOnSite”: {“type”: [“null”, “number”]}, “newVisits”: {“type”: [“null”, “number”]}, “uniqueScreenViews”: {“type”: [“null”, “number”]}, “transactionRevenue”: {“type”: [“null”, “number”]}, “hits”: {“type”: [“null”, “number”]}, “screenviews”: {“type”: [“null”, “number”]}, “bounces”: {“type”: [“null”, “number”]}, “sessionQualityDim”: {“type”: [“null”, “number”]}, “totalTransactionRevenue”: {“type”: [“null”, “number”]}, “pageviews”: {“type”: [“null”, “number”]}, “timeOnScreen”: {“type”: [“null”, “number”]}, “visits”: {“type”: [“null”, “number”]}, “transactions”: {“type”: [“null”, “number”]}}}, “fullVisitorId”: {“type”: [“null”, “string”]}, “socialEngagementType”: {“type”: [“null”, “string”]}, “visitorId”: {“type”: [“null”, “number”]}, “device”: {“type”: [“null”, “object”], “properties”: {“browser”: {“type”: [“null”, “string”]}, “mobileInputSelector”: {“type”: [“null”, “string”]}, “mobileDeviceBranding”: {“type”: [“null”, “string”]}, “browserSize”: {“type”: [“null”, “string”]}, “language”: {“type”: [“null”, “string”]}, “screenResolution”: {“type”: [“null”, “string”]}, “mobileDeviceMarketingName”: {“type”: [“null”, “string”]}, “operatingSystemVersion”: {“type”: [“null”, “string”]}, “browserVersion”: {“type”: [“null”, “string”]}, “deviceCategory”: {“type”: [“null”, “string”]}, “flashVersion”: {“type”: [“null”, “string”]}, “mobileDeviceModel”: {“type”: [“null”, “string”]}, “javaEnabled”: {“type”: [“null”, “boolean”]}, “screenColors”: {“type”: [“null”, “string”]}, “operatingSystem”: {“type”: [“null”, “string”]}, “mobileDeviceInfo”: {“type”: [“null”, “string”]}}}, “channelGrouping”: {“type”: [“null”, “string”]}, “geoNetwork”: {“type”: [“null”, “object”], “properties”: {“subContinent”: {“type”: [“null”, “string”]}, “metro”: {“type”: [“null”, “string”]}, “region”: {“type”: [“null”, “string”]}, “cityId”: {“type”: [“null”, “string”]}, “city”: {“type”: [“null”, “string”]}, “longitude”: {“type”: [“null”, “string”]}, “networkLocation”: {“type”: [“null”, “string”]}, “continent”: {“type”: [“null”, “string”]}, “networkDomain”: {“type”: [“null”, “string”]}, “latitude…
no worries, i fixed it
d
Great! It definitely looks like some extraction is happening now 🙂
m
Thanks, it is awesome product..
d
@mani I'm glad you're liking it! Let me know if I can clear up anything else
m
@douwe_maan, How can i generate tap.config.json for meltano invoke?
d
@mani There's no need to manually generate it! Per https://meltano.com/docs/configuration.html:
Meltano is responsible for managing the configuration of all of a project's plugins. It knows what settings are supported by each plugin, and how and when different types of plugins expect to be fed that configuration.
Since this also goes for extractors and loaders, you do not need to manually craft the `config.json` files expected by Singer taps and targets, because Meltano will generate them on the fly whenever an extractor or loader is used through
meltano elt
or
meltano invoke
.
m
can we have option to store the auto generated file for invoke?
d
Dumping the contents of the generated config files is actually a new feature I'm just about to release in v1.51.0: https://gitlab.com/meltano/meltano/-/issues/2355
If you'd just like to view the current configuration of a plugin, you can use
meltano config <plugin>
When you run
meltano invoke <tap>
, the config file will automatically be generated and provided to the tap using the
--config
option.
Does that help?
m
and it is getting deleted when the execution has done rite, i was thinking if i have any option to store generated file and change directly into the file and pass as elt config, which make life easier instead of running command line for changing in the meta data and schemas
i am not sure it makes any sense or not
meltano config tap-ga360 set _metadata trafficSource * inclusion available
the above code is not working for making all trafficsource children’s inclusion to available
metadata: trafficSource: README.md: analyze: extract: load: meltano.yml: model: notebook: orchestrate: output: requirements.txt: transform: inclusion: available
it created liked above
should we include each attributes for trafficeSource to make the inclusion to available
d
@mani The issue is that the unescaped
*
in your command invocation is interpreted by your shell as "all files in this directory", so it's passing all of the filenames to
meltano config
instead of the literal string
*
. If you'd like to actually send a literal
*
, wrap it in quotes:
meltano config tap-ga360 set _metadata trafficSource "*" inclusion available
m
ooh Got it let me try
d
Instead of using
meltano config tap-ga360 set _metadata
, you can also directly write your desired rules in
meltano.yml
like in the example here: https://meltano.com/docs/plugins.html#in-meltano-yml-3
Once you update to the latest version of Meltano (https://meltano.slack.com/archives/CP8K1MXAN/p1600718468002000), you'll be able to debug catalog generation by dumping the generated catalog file using:
Copy code
meltano elt tap-ga360 <target> --dump=catalog > catalog.json
But once your
metadata
extra in
meltano.yml
has been fixed, I expect it to just work 🙂
m
the metadata is working fine
whatever i have “Selected” it is showing
meltano --log-level=info select --list tap-ga360
d
Perfect! Then it should also work correctly once you run
meltano elt
m
but i could see all the fields in the snowflake
which is weird.
{
“breadcrumb”: [ “properties”, “appInfo”, “properties”, “appInstallerId” ], “metadata”: { “inclusion”: “available”, “selected”: false } }, {
i can see elt tap.config.json which is selected as false
but Snowflake is having that field
d
If you run
meltano --log-level=debug elt ...
and look at the
SCHEMA
messages tap-ga360 is outputting, do they contain additional fields compared to the
RECORD
messages?
m
message has been deleted
I have checked that also , it is not having those fields
d
Can you drop the table in Snowflake and run the extraction again?
m
okay
d
I expect that those other fields were created earlier, before the tap was correctly configured to skip the fields you don't want
But target-snowflake won't delete the old columns automatically
m
no luck, i dropped the table
let me create new schema
still no luck, i guess , the table has created based on schema
not sure it is ignoring the metadata
d
Could it be that the tap is respecting the
selected
metadata when building
RECORD
messages, but ignoring it when building
SCHEMA
messages, which thus always include all attributes/columns?
That would result in
target-snowflake
creating the unselected columns, but not having any values to store in them when the records come in
Does that match what you're seeing?
m
yes, it is not having any values but fields were created
was it bug?
d
I just double checked, and the Singer spec doesn't actually state that properties that aren't selected should be excluded from the
SCHEMA
messages, so while this feels like a bug in https://github.com/singer-io/tap-ga360, it isn't technically one, and you'll probably find the same behavior in most if not all other taps: the unselected columns are created in the DB, even though they're never used
Since Meltano has control over the messages passed between the tap and the target, it could automatically modify the
SCHEMA
messages to remove unselected properties, but that's not currently implemented. I welcome a new issue in https://gitlab.com/meltano/meltano/-/issues, though 🙂
Is the current behavior of the tap acceptable to you, even if it's not ideal?
m
ill remove in the schema unused fields
d
It looks like the tap always loads the full schema from the embedded JSON files, though: https://github.com/singer-io/tap-ga360/blob/master/tap_ga360/streams.py#L49
So even if you remove the unused fields from the schema by manually editing the catalog and specifying it using https://meltano.com/docs/plugins.html#catalog-extra, the
SCHEMA
messages will still contain all attributes
m
ill try that,
d
I think we'll need to modify https://github.com/singer-io/tap-ga360/blob/master/tap_ga360/streams.py#L49 to get the schema from the provided catalog to take priority over the embedded schema
m
ooh, ill see if i can do it directly the schema folders if u guys piled up with other priorities .
d
https://github.com/singer-io/tap-ga360 is not maintained by us, so fixing bugs (or improving its behavior) is not a priority for us. The idea is that we can focus fully on making Meltano the best possible Singer runner, so that users can focus on improving the individual Singer taps and targets 🙂
m
ooh i see, thats ok,ill it do it my local machine
is there way i can have updates for lifetime?
d
Meltano is a GitLab project, so we've got plenty of investment already 🙂 The plan is to continue to focus solely on the open source version for the foreseeable future (measured in years, not months), and to then eventually figure out a business model around the open source version, just like we did with GitLab itself.
And as long as there is a community of Meltano and Singer users, there will be people with an interest in maintaining and improving Singer taps and targets, so you should be good, especially with a data source as big as GA360
And even if GitLab were to one day decide to stop working on Meltano, the project is licensed MIT so users are free to fork it and maintain their fork as long as they want.
m
Got it , Thanks and you guys are doing awesome job..
i am planning to move Production next week. just a quick, is there way framework have email notifications if any exceptions or scheduled pipeline failures
d
@mani Are you planning to set up Meltano with Airflow or another orchestrator? Notifications are the orchestrator's responsible, in our view, and Airflow (etc) have their own functionality for that 🙂
m
Perfect,ill check those tools tomorrow
thanks
d
Sounds great!
m
@douwe_maan, i am getting the below error
To learn more about file bundle ‘airflow’, visit https://gitlab.com/meltano/files-airflow (.venv) manigovindarajulu@Manis-MBP ga360 % meltano invoke airflow scheduler [2020-09-22 113354,371] [14482|MainThread|meltano.cli.invoke] [ERROR] /Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/orchestrators/airflow/venv/lib/python3.8/site-packages/airflow/www/app.py27 DeprecationWarning: The import ‘werkzeug.wsgi.DispatcherMiddleware’ is deprecated and will be removed in Werkzeug 1.0. Use ‘from werkzeug.middleware.dispatcher import DispatcherMiddleware’ instead.  from werkzeug.wsgi import DispatcherMiddleware Traceback (most recent call last):  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/orchestrators/airflow/venv/bin/airflow”, line 22, in <module>   from airflow.bin.cli import CLIFactory  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/orchestrators/airflow/venv/lib/python3.8/site-packages/airflow/bin/cli.py”, line 66, in <module>   from airflow.www.app import (cached_app, create_app)  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/orchestrators/airflow/venv/lib/python3.8/site-packages/airflow/www/app.py”, line 35, in <module>   from airflow.www.blueprints import routes  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/orchestrators/airflow/venv/lib/python3.8/site-packages/airflow/www/blueprints.py”, line 29, in <module>   from airflow.www import utils as wwwutils  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/orchestrators/airflow/venv/lib/python3.8/site-packages/airflow/www/utils.py”, line 26, in <module>   from cgi import escape ImportError: cannot import name ‘escape’ from ‘cgi’ (/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/cgi.py) Airflow metadata database could not be initialized:
airflow initdb
failed
d
@mani The version of Airflow that Meltano currently installs doesn't support Python 3.8 yet: https://gitlab.com/meltano/meltano/-/issues/1956#note_413781207 Would it be an option to use Python 3.6 or 3.7 instead, until we resolve that issue and officially support 3.8?
m
does meltano runs 3.7?
d
3.7 is supported, yeah
m
thanks
@douwe_maan, i have setup Seperate Airflow and changed the DAGS folder pointing to meltano project dag folder
but i wont be able to see that n airflow
d
@mani Did you add the default Meltano DAG generator (https://gitlab.com/meltano/files-airflow/-/blob/master/bundle/orchestrate/dags/meltano.py) to your
orchestrate/dags
directory using
meltano add files airflow
?
m
yes
d
Have you defined schedules using
meltano schedule
, that will show up in
meltano.yml
under
schedules
?
And if so, do you see any mentions of Meltano in the
airflow scheduler
output?
m
let me define the schedule i guess i missed it
d
Per https://meltano.com/docs/orchestration.html#using-an-existing-airflow-installation:
This setup assumes you'll use
meltano schedule
to schedule your
meltano elt
pipelines, as described above, since the DAG generator iterates over the result of
meltano schedule list --format=json
and creates DAGs for each.
m
meltano schedule loadGA360 tap-ga360 target-snowflake @once
Traceback (most recent call last):  File “/usr/local/bin/meltano”, line 8, in <module>   sys.exit(main())  File “/usr/local/lib/python3.6/site-packages/meltano/cli/__init__.py”, line 38, in main   cli(obj={“project”: None})  File “/usr/local/lib/python3.6/site-packages/click/core.py”, line 764, in call   return self.main(*args, **kwargs)  File “/usr/local/lib/python3.6/site-packages/click/core.py”, line 717, in main   rv = self.invoke(ctx)  File “/usr/local/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke   return _process_result(sub_ctx.command.invoke(sub_ctx))  File “/usr/local/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke   return _process_result(sub_ctx.command.invoke(sub_ctx))  File “/usr/local/lib/python3.6/site-packages/click/core.py”, line 956, in invoke   return ctx.invoke(self.callback, **ctx.params)  File “/usr/local/lib/python3.6/site-packages/click/core.py”, line 555, in invoke   return callback(*args, **kwargs)  File “/usr/local/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func   return f(get_current_context(), *args, **kwargs)  File “/usr/local/lib/python3.6/site-packages/meltano/cli/schedule.py”, line 54, in add   session, name, extractor, loader, transform, interval, start_date  File “/usr/local/lib/python3.6/site-packages/meltano/core/schedule_service.py”, line 57, in add   session, extractor  File “/usr/local/lib/python3.6/site-packages/meltano/core/schedule_service.py”, line 93, in default_start_date   return iso8601_datetime(start_date) or datetime.utcnow()  File “/usr/local/lib/python3.6/site-packages/meltano/core/utils/__init__.py”, line 234, in iso8601_datetime   raise ValueError(f”{d} is not a valid UTC date.“) ValueError: 20200911 is not a valid UTC date.
not sure schedule is taking tap-ga360 start-date config
extractors:
 - name: tap-ga360   namespace: tap_ga360   pip_url: tap-ga360   executable: tap-ga360   capabilities:   - catalog   - discover   - state   config:    start_date: ‘20200911’    project_id: peupnportal
d
Does formatting the start_date as
2020-09-11
fix this?
Meltano assumes
start_date
s follow the ISO8601 spec
(Tip: If you want to format multiple lines as source code, start with three backticks like in Markdown: ```)
m
@douwe_maan, i need a another help regarding tap mongo and target snowflake
’, ‘version’: 1601909513223}}, ‘currently_syncing’: ‘unified_admin-events’} target-snowflake    | WARNING ACTIVATE_VERSION message target-snowflake    | CRITICAL ‘type’ target-snowflake    | Traceback (most recent call last): target-snowflake    |  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/loaders/target-snowflake/venv/bin/target-snowflake”, line 11, in <module> target-snowflake    |   load_entry_point(‘target-snowflake==0.1.1’, ‘console_scripts’, ‘target-snowflake’)() target-snowflake    |  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/__init__.py”, line 91, in main target-snowflake    |   raise exc target-snowflake    |  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/__init__.py”, line 76, in main target-snowflake    |   main_implementation() target-snowflake    |  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/__init__.py”, line 66, in main_implementation target-snowflake    |   process_input(config, input) target-snowflake    |  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/__init__.py”, line 40, in process_input target-snowflake    |   target.process_line(line) target-snowflake    |  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/target_snowflake.py”, line 331, in process_line target-snowflake    |   sqlalchemy_table = generate_sqlalchemy_table( target-snowflake    |  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/utils/singer_target_utils.py”, line 26, in generate_sqlalchemy_table target-snowflake    |   flat_schema = flatten_schema(json_schema) target-snowflake    |  File “/Users/manigovindarajulu/Documents/singer/meltano-projects/ga360/.meltano/loaders/target-snowflake/venv/lib/python3.8/site-packages/target_snowflake/utils/singer_target_utils.py”, line 118, in flatten_schema target-snowflake    |   if property[“type”] == “string”: target-snowflake    | KeyError: ‘type’
d
@mani That suggests that the target is receiving an invalid (or unsupported)
SCHEMA
message from the tap. Can you enable debug mode (
meltano --log-level=debug elt ...
), so that we can see the exact
SCHEMA
message that triggered this error?
m
{"type": "SCHEMA", "stream": "events", "schema": {"type": "object", "properties": {"start_date": {"anyOf": [{"type": "string", "format": "date-time"}, {}]}, "end_date": {"anyOf": [{"type": "string", "format": "date-time"}, {}]}, "updated_at": {"anyOf": [{"type": "string", "format": "date-time"}, {}]}, "created_at": {"anyOf": [{"type": "string", "format": "date-time"}, {}]}, "event_population_filters": {"anyOf": [{}]}, "notif_roles": {"anyOf": [{}]}, "deleted_at": {"anyOf": [{"type": "string", "format": "date-time"}, {}]}}}, "key_properties": ["_id"]}
this is schema is getting generated by mongo tap
it is not taking from my catalog file
{
“streams”: [ { “table_name”: “events”, “stream”: “events”, “metadata”: [ { “breadcrumb”: [], “metadata”: { “table-key-properties”: [ “_id” ], “database-name”: “unified_admin”, “row-count”: 6, “is-view”: false, “valid-replication-keys”: [ “_id” ], “selected”: true, “replication-method”: “FULL_TABLE”, “replication-key”: “_id”, “replication_key_type”: “String” } } ], “tap_stream_id”: “unified_admin-events”, “schema”: { “type”: [ “null”, “object” ], “properties”: { “_id”: { “type”: [ “null”, “string” ] }, “title”: { “type”: [ “null”, “string” ] } } }, “selected”: true } ] }
d
@mani The problem is that the schema for these two properties is invalid, since they lack a
"type"
key:
Copy code
"event_population_filters": { "anyOf": [{}] },
"notif_roles": { "anyOf": [{}] },
The other properties also have an empty object at the end of their
anyOf
arrays, which is also invalid, but is ignored by the target since they define at least one type:
Copy code
"start_date": {"anyOf": [{"type": "string", "format": "date-time"}, {}]}
Which exact MongoDB tap are you using?
m
tap-mongodb==2.0.0
The schema was generated by tap, the one i gave as a catalog is not taking
d
I suggest explicitly specifying a projection (https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/) as described under https://github.com/singer-io/tap-mongodb#edit-catalog-file, so that only the specific fields you need are queried from MongoDB. Inside the
metadata
object, it'd look like:
Copy code
"tap-mongodb.projection": "{\"_id\": 1, \"title\": 1}"
(It needs to be an escaped JSON string per https://github.com/singer-io/tap-mongodb/blob/f0fcc01e679acb40689b952d418425500fd17612/tap_mongodb/__init__.py#L239)
Are you currently setting
metadata
in
meltano.yml
, as in https://meltano.com/docs/plugins.html#metadata-extra, or are you manually building and specifying a catalog file? Using the YAML
metadata
feature won't work here, unfortunately, because it would interpret
tap-mongodb.projection: <value>
as a
projection
metadata key for the (nonexistent)
tap-mongodb
property, rather than a ``tap-mongodb.projection`` metadata key for the stream as a whole, because periods are interpreted as nested properties: https://meltano.com/docs/command-line-interface.html#nested-properties So to try this out, I'd suggest building and providing a catalog file manually. We can then look into fixing this issue in Meltano.
m
yes i tried first and then now i am using passing the catalog file
d
I've created an issue for this: https://gitlab.com/meltano/meltano/-/issues/2388