Hi, I’m having trouble with the syntax to alias a ...
# troubleshooting
j
Hi, I’m having trouble with the syntax to alias a property using
stream_maps
+
meltano.yml
. What is the correct way to alias a property?
I’m hoping to alias “Contract Date” as “contract_date”. I’ve tried the following syntax but the first yields no change and the second creates a new
contract_date
property with
'Contract Date'
value.
Copy code
#meltano.yml
plugins:
  extractors:
  - name: tap-custom
    config:
      stream_maps:
        sales:
          "Contract Date": contract_date
Copy code
#meltano.yml
plugins:
  extractors:
  - name: tap-custom
    config:
      stream_maps:
        sales:
          contract_date: "\"Contract Date\""
m
you are trying to rename the existing column
Contract Date
as
contract_date
?
hmm, https://sdk.meltano.com/en/latest/stream_maps.html#property-level-mapping-applications says this is possible but there aren’t any examples. I wonder if this would work:
Copy code
#meltano.yml
plugins:
  extractors:
  - name: tap-custom
    config:
      stream_maps:
        sales:
          contract_date: "record['Contract Date']"
maybe it should be this, to drop the field with the old name too?
Copy code
#meltano.yml
plugins:
  extractors:
  - name: tap-custom
    config:
      stream_maps:
        sales:
          contract_date: "record['Contract Date']"
          "Contract Date": null
j
you are trying to rename the existing column
Contract Date
as
contract_date
?
Yes
I wonder if this would work:
```#meltano.yml
plugins:
extractors:
- name: tap-custom
config:
stream_maps:
sales:
contract_date: "record['Contract Date']"```
The above syntax worked, thanks Matt!
maybe it should be this, to drop the field with the old name too?
I added
"Contract Date": null
but the property still appeared in the output 🤔
I tried
__else__: null
and that also didn’t work for some reason
e
@joseph_lozano can you try
__else__: __NULL__
?
j
That works, thanks Edgar!
Copy code
#meltano.yml
plugins:
  extractors:
  - name: tap-custom
    config:
      stream_maps:
        sales:
          contract_date: "record['Contract Date']"
          __else__: __NULL__
f
Hey folks! Taking from here, with a similar example (sending to channel to help bump up). What if I still wanted to hide the
record['Contract Date']
column in the previous example, without using
else
?
e
Hey @felippe_felisola_caso, is
Contract Date: __NULL__
what you need?
f
That’s right! And that doesn’t work due to the space (or other special characters, in my case). But, actually, what I really want like Joseph is to change a column’s name. I’m assuming that the canon way of doing that is the one here in the thread: • Creating a new one with the contents of the previous • Hiding the previous
e
And that doesn’t work
Have you tried wrapping the column name in quotes:
Copy code
plugins:
  extractors:
  - name: tap-custom
    config:
      stream_maps:
        sales:
          contract_date: "record['Contract Date']"
          "Contract Date": __NULL__
f
That actually worked! I probably missed that one out in the several trials between variations of
null
,
__NULL__
and
record[]
Thanks a lot, Edgar 😃