Skip to content

CLN: Removed _SAFE_NAMES_WARNING in io.sql #44361

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

Merged
merged 3 commits into from
Nov 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1818,12 +1818,6 @@ def _get_valid_sqlite_name(name):
return '"' + uname.replace('"', '""') + '"'


_SAFE_NAMES_WARNING = (
"The spaces in these column names will not be changed. "
"In pandas versions < 0.14, spaces were converted to underscores."
)


class SQLiteTable(SQLTable):
"""
Patch the SQLTable for fallback support.
Expand Down Expand Up @@ -1883,12 +1877,6 @@ def _create_table_setup(self):
statement while the rest will be CREATE INDEX statements.
"""
column_names_and_types = self._get_column_names_and_types(self._sql_type_name)

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=find_stack_level())

escape = _get_valid_sqlite_name

create_tbl_stmts = [
Expand Down
7 changes: 0 additions & 7 deletions pandas/tests/io/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1366,13 +1366,6 @@ def test_read_sql_delegate(self):
with pytest.raises(sql.DatabaseError, match=msg):
sql.read_sql("iris", self.conn)

def test_safe_names_warning(self):
# GH 6798
df = DataFrame([[1, 2], [3, 4]], columns=["a", "b "]) # has a space
# warns on create table with spaces in names
with tm.assert_produces_warning(UserWarning):
sql.to_sql(df, "test_frame3_legacy", self.conn, index=False)

def test_get_schema2(self, test_frame1):
# without providing a connection object (available for backwards comp)
create_sql = sql.get_schema(test_frame1, "test")
Expand Down