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

transform-field-names: Skip field if old_field_name == new_field_name #37

Closed
joverlee521 opened this issue May 28, 2024 · 0 comments · Fixed by #38
Closed

transform-field-names: Skip field if old_field_name == new_field_name #37

joverlee521 opened this issue May 28, 2024 · 0 comments · Fixed by #38
Labels
enhancement New feature or request

Comments

@joverlee521
Copy link
Contributor

Context

Prompted by nextstrain/avian-flu#40 (comment)

The current workaround is to use the --force flag to silence the warnings, but this can result in missing actual field name overwrites.

Description

If the old field name is the same as the new field name, then the script should skip renaming which would skip the loud warning:

for old_field, new_field in field_map.items():
if record.get(new_field) and not args.force:
print(
f"WARNING: skipping rename of {old_field} because record",
f"already has a field named {new_field}.",
file=stderr
)
continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant