Skip to content

Commit 7b106e4

Browse files
Hugues ValoisTomAugspurger
Hugues Valois
authored andcommitted
TST: writing invalid table names to sqlite (#16464)
* Add test for bug #13206. * Improve test by reading back the values from sql and comparing. Also fixes coding style violation.
1 parent fb47ee5 commit 7b106e4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/io/test_sql.py

+10
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,16 @@ def test_unicode_column_name(self):
816816
df = DataFrame([[1, 2], [3, 4]], columns=[u'\xe9', u'b'])
817817
df.to_sql('test_unicode', self.conn, index=False)
818818

819+
def test_escaped_table_name(self):
820+
# GH 13206
821+
df = DataFrame({'A': [0, 1, 2], 'B': [0.2, np.nan, 5.6]})
822+
df.to_sql('d1187b08-4943-4c8d-a7f6', self.conn, index=False)
823+
824+
res = sql.read_sql_query('SELECT * FROM `d1187b08-4943-4c8d-a7f6`',
825+
self.conn)
826+
827+
tm.assert_frame_equal(res, df)
828+
819829

820830
@pytest.mark.single
821831
class TestSQLApi(SQLAlchemyMixIn, _TestSQLApi):

0 commit comments

Comments
 (0)