Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: property-level aliases/renaming doesn't appear to work #8185

Open
kcphila opened this issue Sep 25, 2023 · 2 comments
Open

bug: property-level aliases/renaming doesn't appear to work #8185

kcphila opened this issue Sep 25, 2023 · 2 comments
Labels
kind/Bug Something isn't working valuestream/Meltano

Comments

@kcphila
Copy link

kcphila commented Sep 25, 2023

Meltano Version

3.0.0

Python Version

3.10

Bug scope

CLI (options, error messages, logging, etc.)

Operating System

Linux - 20.04

Description

Multiple core docs specify that properties can be renamed with mappers:

  • The meltano mappers guide documentation indicates, in the Property (Column) Level, section, that Aliasing: properties can be renamed in the resulting stream e.g. altering a column name from id -> customer_id
  • The Meltano SDK stream_maps documentation, in the Property-Level Mapping Applications section, indicate that stream_maps support Property-level aliasing: properties can be renamed in the resulting stream.

However, in v3.0.0, either this no longer works or all documentation that provides examples have been lost, as I searched through the docs as well as the source code for both the SDK and the meltano-map-transform plugin.

For example, for a config file that looks like :

...
  mappers:
  - name: meltano-map-transformer
    variant: meltano
    pip_url: git+https://github.com/MeltanoLabs/meltano-map-transform.git
    mappings:
    - name: lower-case-schema
      config:
        stream_maps:
          {STREAM_NAME}:
            __alias__: {new-table-name}
            {COLUMN-PROPERTY}:
              __alias__: {new-property-name}
...

The stream/table name is renamed but the property/column is not. There is a partial work around to make a copy of the column and then delete the old column.

      config:
        stream_maps:
          {STREAM_NAME}:
            __alias__: {new-table-name}
            {new-property-name}: {COLUMN-PROPERTY}
            {COLUMN-PROPERTY}: __NULL__

Sorry if this isn't quite a "bug" or if issues with the mapper belong somewhere else - it was not clear where communication / contribution streams are or go (and Slack is unfortunately blocked at my workplace).

Code

...
  mappers:
  - name: meltano-map-transformer
    variant: meltano
    pip_url: git+https://github.com/MeltanoLabs/meltano-map-transform.git
    mappings:
    - name: lower-case-schema
      config:
        stream_maps:
          {STREAM_NAME}:
            __alias__: {new-table-name}
            {COLUMN-PROPERTY}:
              __alias__: {new-property-name}
...
@kcphila kcphila added kind/Bug Something isn't working valuestream/Meltano labels Sep 25, 2023
@edgarrmondragon
Copy link
Collaborator

Hi @kcphila! Thanks for logging.

This format, with nested column properties is not actually supported

  mappers:
  - name: meltano-map-transformer
    variant: meltano
    pip_url: git+https://github.com/MeltanoLabs/meltano-map-transform.git
    mappings:
    - name: lower-case-schema
      config:
        stream_maps:
          {STREAM_NAME}:
            __alias__: {new-table-name}
            {COLUMN-PROPERTY}:
              __alias__: {new-property-name}

so I'm curious if you found an example like it in the docs, or whether you were following similar patterns for other Meltano settings.


There is a partial work around to make a copy of the column and then delete the old column.

Is the workaround not good enough for your use case? If so, what are you missing that's not supported by the "copy and delete" approach?

@kcphila
Copy link
Author

kcphila commented Sep 26, 2023

This format, with nested column properties is not actually supported

Hi @edgarrmondragon,

Thanks for the quick response.

There weren't code examples of the nested column format (aside from some "this would be nice" in feature requests), but the two main mapper doc pages both list changing property names as an existing feature of mappers (meltano mappers guide documentation and Meltano SDK stream_maps documentation). So, if property renaming isn't actually an existing (or soon to be coming) feature, it should be removed from the docs.

The copy/delete is doable (especially since it looks like __else__: __NULL__ will clear out the original column names) - but the real need is to be able to handle renames/reformats of the property schema in bulk - Is there some other way to do inline property/schema changes? The meltano/singer Oracle tap pulls in all uppercase, and so what I'm really looking to do as a starting point is something like (and it does seem like it would require a special key to refer to the stream metadata definition):

      config:
        stream_maps:
          {STREAM_NAME}:
            __meta__[col['name'].lower()]: col

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/Bug Something isn't working valuestream/Meltano
Projects
None yet
Development

No branches or pull requests

2 participants