-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: Only do case sensitive check when not lower case #12880
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1248,19 +1248,23 @@ def to_sql(self, frame, name, if_exists='fail', index=True, | |
schema=schema, dtype=dtype) | ||
table.create() | ||
table.insert(chunksize) | ||
# check for potentially case sensitivity issues (GH7815) | ||
engine = self.connectable.engine | ||
with self.connectable.connect() as conn: | ||
table_names = engine.table_names( | ||
schema=schema or self.meta.schema, | ||
connection=conn, | ||
) | ||
if name not in table_names: | ||
warnings.warn("The provided table name '{0}' is not found exactly " | ||
"as such in the database after writing the table, " | ||
"possibly due to case sensitivity issues. Consider " | ||
"using lower case table names.".format(name), | ||
UserWarning) | ||
if (not name.isdigit() and not name.islower()): | ||
# check for potentially case sensitivity issues (GH7815) | ||
# Only check when name is not a number and name is not lower case | ||
engine = self.connectable.engine | ||
with self.connectable.connect() as conn: | ||
table_names = engine.table_names( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you give some tests for this (and for the warning). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure will do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jreback Apparently the warning itself can't be tested There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I indeed put a comment here a while ago that I couldn't test it .. :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To conclude: I think it is OK to merge this without an explicit test |
||
schema=schema or self.meta.schema, | ||
connection=conn, | ||
) | ||
if name not in table_names: | ||
msg = ( | ||
"The provided table name '{0}' is not found exactly as " | ||
"such in the database after writing the table, possibly " | ||
"due to case sensitivity issues. Consider using lower " | ||
"case table names." | ||
).format(name) | ||
warnings.warn(msg, UserWarning) | ||
|
||
@property | ||
def tables(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case sensitivity for tables.