File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ Bug Fixes
6565- Bug in slicing a multi-index with an empty list and at least one boolean indexer (:issue:`8781`)
6666- ``io.data.Options`` now raises ``RemoteDataError`` when no expiry dates are available from Yahoo (:issue:`8761`).
6767- ``Timedelta`` kwargs may now be numpy ints and floats (:issue:`8757`).
68-
68+ - ``sql_schema`` now generates dialect appropriate ``CREATE TABLE`` statements (:issue:`8697`)
6969
7070
7171
Original file line number Diff line number Diff line change @@ -621,7 +621,7 @@ def exists(self):
621621
622622 def sql_schema (self ):
623623 from sqlalchemy .schema import CreateTable
624- return str (CreateTable (self .table ))
624+ return str (CreateTable (self .table ). compile ( self . pd_sql . engine ) )
625625
626626 def _execute_create (self ):
627627 # Inserting table into database, add to MetaData object
Original file line number Diff line number Diff line change @@ -1155,6 +1155,19 @@ def test_to_sql_save_index(self):
11551155 def test_transactions (self ):
11561156 self ._transaction_test ()
11571157
1158+ def test_get_schema_create_table (self ):
1159+ self ._load_test2_data ()
1160+ tbl = 'test_get_schema_create_table'
1161+ create_sql = sql .get_schema (self .test_frame2 , tbl , con = self .conn )
1162+ blank_test_df = self .test_frame2 .iloc [:0 ]
1163+
1164+ self .drop_table (tbl )
1165+ self .conn .execute (create_sql )
1166+ returned_df = sql .read_sql_table (tbl , self .conn )
1167+ tm .assert_frame_equal (returned_df , blank_test_df )
1168+ self .drop_table (tbl )
1169+
1170+
11581171class TestSQLiteAlchemy (_TestSQLAlchemy ):
11591172 """
11601173 Test the sqlalchemy backend against an in-memory sqlite database.
You can’t perform that action at this time.
0 commit comments