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

mimic-iv/buildmimic/sqlite/import.py: replace strip() #1360

Merged
merged 1 commit into from
Aug 12, 2022

Conversation

schu
Copy link
Contributor

@schu schu commented Aug 10, 2022

strip() removes any of the given characters from both the start and
end of a string: https://docs.python.org/3/library/stdtypes.html#str.strip
For a filename "chartevents.csv.gz" the resulting tablename currently is
"hartevent" where it should be "chartevents".

'chartevents'.strip('.gz').strip('.csv').lower()

Instead, strip the suffixes manually to derive the tablename from the
filename.

Later, we could use removesuffix(), which is available from Python 3.9
onwards: https://docs.python.org/3/library/stdtypes.html#str.removesuffix

`strip()` removes any of the given characters from both the start and
end of a string: https://docs.python.org/3/library/stdtypes.html#str.strip
For a filename "chartevents.csv.gz" the resulting tablename currently is
"hartevent" where it should be "chartevents".

    'chartevents'.strip('.gz').strip('.csv').lower()

Instead, strip the suffixes manually to derive the tablename from the
filename.

Later, we could use `removesuffix()`, which is available from Python 3.9
onwards: https://docs.python.org/3/library/stdtypes.html#str.removesuffix
@alistairewj alistairewj merged commit db59d5e into MIT-LCP:main Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants