https://slingdata.io logo
m
Hi, I need to rename a field in replication. Tried this way from docs (generated inside ai in search bar) source: MY_SOURCE_DB target: MY_TARGET_DB streams: my_schema.my_table: transforms: # stage 1: copy old column to new name - new_col: 'record.old_col' # exclude the original column from the final output select: [-old_col, '*'] So, I have implemented it: finadash.my_table: # disabled: true mode: incremental primary_key: - brand_id - account_id update_key: updated_at transforms: - group_name: 'record.group' select: [-group, '*'] And receiving next error: All specified select columns must be excluded with prefix '-'. Cannot do partial exclude. Also, I treid without '*' in select: ~ dataflow error while waiting for ready state ~ error in getting rows ~ could not evaluate expression (record.group), with value= for column group_name var error: object has no member "group" Please assist
f
for the
select
, Yea you'll need to remove
*
the error relates to the
transforms
, it means the column`group` is not found in the table. Are you sure
group
exists?
m
Sure 100%
Hi, still have problem with this.. I have several tables where Im renaming the source column.. so I little bit stuck with that.
f
hey @marikt94 did you remove the
*
? also can you paste the yaml replication and the debug log? one more thing, please use code blocks for your YAML in your discord message, with the triple backticks , would make it easier for me to read šŸ™‚
m
Sure,
Copy code
finadash.leveraged_trading_accounts:
    # disabled: true
    mode: incremental
    primary_key: 
      - brand_id
      - login
    update_key: updated_at
    transforms:
      - group_name: 'record.group'
    select: [-group]
https://cdn.discordapp.com/attachments/1436042318129135668/1443241504729731274/message.txt?ex=69285ae4&is=69270964&hm=4abdec0d182d42499438b5c6c53a66336f561f6798e93f02f7cfe1c638e9d7e0&
As I mentioned, the gorup column is exists.. the whole renaming code was remarked before.. So my target table with "group" column..
f
@marikt94 so you're SELECTing without
group
what i'm seeing is you want to rename
group
to
group_name
m
Correct
f
yeah, transforms are applied after the rows are pulled (without group)
so it doesn't find it.
m
Is there a way to do it without transform? because there is no changes on data actually but only label is changed.. sound strange to use transform for that
its like to change columns in dataframe for me, but not to calculate a new values
f
right.. no currently. you'd have to with the custom SQL. But I just had an idea: maybe allowing the select to specify alias, like :
Copy code
select: ['*', "group:group_name"]
šŸ¤”
i'll need to think it over, but that could be cool
m
Yep, it can be perfect.
trying to avoid using sql because need to define every part and there is alot of columns that should be lowercase so I using the target options
f
yeah i understand
issue with
group:group_name
is if a column exists with that exact name
m
I would like to get you update about it.. need solution as soon as possible.. but for now will use sql
Dont sure if I get it
f
maybe accept as object or array:
Copy code
select: {
  "*": "*"
  "group": "group_name"
}
I'll advise you about it when it's finalized