Hi, does anyone know if there's a way to override,...
# troubleshooting
r
Hi, does anyone know if there's a way to override, rather than merge,
metadata
for an extractor that inherits from another that also defines
metadata
?
e
So you're saying the current behavior is for the inherited plugin's metadata object to have the keys from the parent too? i.e.
Copy code
extractors:
- name: tap-postgres
  metadata:
    some_stream_id:
      replication-method: LOG_BASED
- name: tap-postgres-2
  inherit_from: tap-postgres
  metadata:
    another_stream_id:
      replication-method: LOG_BASED
But the actual
metadata
object for
tap-postgres-2
also includes
another_stream_id
?
r
Yup:
Copy code
$ meltano config list tap-postgres

...

Custom extras, plugin-specific options handled by Meltano:
_metadata.some_stream_id.replication-method [env: TAP_POSTGRES_2__METADATA_SOME_STREAM_ID_REPLICATION_METHOD] current value: 'LOG_BASED' (inherited from 'tap-postgres')
_metadata.another_stream_id.replication-method [env: TAP_POSTGRES_2__METADATA_ANOTHER_STREAM_ID_REPLICATION_METHOD] current value: 'LOG_BASED' (from `meltano.yml`)
e
Ah so it's because
_metadata.some_stream_id.replication-method
and
_metadata.another_stream_id.replication-method
are treated as independent settings that inherited on their own. Maybe?
Copy code
extractors:
- name: tap-postgres
  metadata:
    some_stream_id:
      replication-method: LOG_BASED
- name: tap-postgres-2
  inherit_from: tap-postgres
  metadata:
    some_stream_id: {}
    another_stream_id:
      replication-method: LOG_BASED
r
Copy code
Custom extras, plugin-specific options handled by Meltano:
_metadata.some_stream_id.replication-method [env: TAP_POSTGRES_2__METADATA_SOME_STREAM_ID_REPLICATION_METHOD] current value: 'LOG_BASED' (inherited from 'tap-postgres')
_metadata.some_stream_id [env: TAP_POSTGRES_2__METADATA_SOME_STREAM_ID] current value: {} (from `meltano.yml`)
_metadata.another_stream_id.replication-method [env: TAP_POSTGRES_2__METADATA_ANOTHER_STREAM_ID_REPLICATION_METHOD] current value: 'LOG_BASED' (from `meltano.yml`)
I don't really want to have to re-declare all the metadata stream keys from the parent anyway...
v
I would try this
Copy code
- name: tap-postgres
- name: tap-postgres-main # Metadata
  inherit_from: tap-postgres
  metadata:
    stufhere: stuffhere
- name: tap-postgres-overridemetadata
  inherit_from: tap-postgres
So you can share most things but don't have to share metadata 😄
hacky but it'd probably do the job!
r
Yeah, I did weigh that up as a solution. Unfortunately, in the case I am dealing with the base plugin is referenced externally in a bunch of places that makes it a fairly loaded change to refactor out as two separate inheriting plugins.
1
🫤 1