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
65
65
- Bug in slicing a multi-index with an empty list and at least one boolean indexer (:issue:`8781`)
66
66
- ``io.data.Options`` now raises ``RemoteDataError`` when no expiry dates are available from Yahoo (:issue:`8761`).
67
67
- ``Timedelta`` kwargs may now be numpy ints and floats (:issue:`8757`).
68
-
68
+ - ``sql_schema`` now generates dialect appropriate ``CREATE TABLE`` statements (:issue:`8697`)
69
69
70
70
71
71
Original file line number Diff line number Diff line change @@ -621,7 +621,7 @@ def exists(self):
621
621
622
622
def sql_schema (self ):
623
623
from sqlalchemy .schema import CreateTable
624
- return str (CreateTable (self .table ))
624
+ return str (CreateTable (self .table ). compile ( self . pd_sql . engine ) )
625
625
626
626
def _execute_create (self ):
627
627
# 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):
1155
1155
def test_transactions (self ):
1156
1156
self ._transaction_test ()
1157
1157
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
+
1158
1171
class TestSQLiteAlchemy (_TestSQLAlchemy ):
1159
1172
"""
1160
1173
Test the sqlalchemy backend against an in-memory sqlite database.
You can’t perform that action at this time.
0 commit comments