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

feat: Support using the stream name or alias in the context of a stream map #2283

Closed
edgarrmondragon opened this issue Mar 5, 2024 · 0 comments · Fixed by #2699
Closed

Comments

@edgarrmondragon
Copy link
Collaborator

Feature scope

Taps (catalog, state, stream maps, tests, etc.)

Description

Allow users to reference the stream name or alias in stream maps under a special key, similar to record and config:

{
    "stream_maps": {
        "countries": {
            "source_table": "__stream_name__",
            "source_key": "code",
            "source_data": "record",
            "__key_properties__": ["source_key"],
            "__else__": "__NULL__"
        }
    }
}

This should be relatively easy to add in

sdk/singer_sdk/mapper.py

Lines 331 to 334 in 2d3bf56

names = record.copy() # Start with names from record properties
names["_"] = record # Add a shorthand alias in case of reserved words in names
names["record"] = record # ...and a longhand alias
names["config"] = self.map_config # Allow map config access within transform

@edgarrmondragon edgarrmondragon changed the title feat: Support using the stream in the context of a stream map feat: Support using the stream name or alias in the context of a stream map Mar 5, 2024
@edgarrmondragon edgarrmondragon added this to the v0.42.0 milestone Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant