Skip to content

Is io.sql._SAFE_NAMES_WARNING still relevant? #44295

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

Closed
awisse opened this issue Nov 2, 2021 · 1 comment · Fixed by #44361
Closed

Is io.sql._SAFE_NAMES_WARNING still relevant? #44295

awisse opened this issue Nov 2, 2021 · 1 comment · Fixed by #44361
Labels
Clean Error Reporting Incorrect or improved errors from pandas good first issue IO SQL to_sql, read_sql, read_sql_query
Milestone

Comments

@awisse
Copy link

awisse commented Nov 2, 2021

Is your feature request related to a problem?

When I try to dump a DataFrame which has spaces in columns into an SQLite database, I get the _SAFE_NAMES_WARNING. However, spaces in column names are no longer changed to underscores since version 0.14. This warning should be removed. IMHO it is no longer relevant.

Describe the solution you'd like

Remove the following lines from io/sql.py in function SQLiteTable._create_table_setup:

        pat = re.compile(r"\s+")
        column_names = [col_name for col_name, _, _ in column_names_and_types]
        if any(map(pat.search, column_names)):
            warnings.warn(_SAFE_NAMES_WARNING, stacklevel=6)

API breaking implications

None

Describe alternatives you've considered

None

Additional context

@awisse awisse added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 2, 2021
@lithomas1 lithomas1 added Error Reporting Incorrect or improved errors from pandas IO SQL to_sql, read_sql, read_sql_query and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Nov 2, 2021
@lithomas1 lithomas1 added this to the Contributions Welcome milestone Nov 2, 2021
@EdAbati
Copy link
Contributor

EdAbati commented Nov 3, 2021

Hi, I would like to try to solve this one, if it is OK.

@jreback jreback modified the milestones: Contributions Welcome, 1.4 Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Error Reporting Incorrect or improved errors from pandas good first issue IO SQL to_sql, read_sql, read_sql_query
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants