Skip to content

Commit

Permalink
DEPR: removal of deprecated pd.io.sql.read_frame/frame_query functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisvandenbossche committed Feb 2, 2016
1 parent 6a32f10 commit 541e0e7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 34 deletions.
3 changes: 2 additions & 1 deletion doc/source/whatsnew/v0.18.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ Removal of prior version deprecations/changes
- Removal of ``expanding_corr_pairwise`` in favor of ``.expanding().corr(pairwise=True)`` (:issue:`4950`)
- Removal of ``DataMatrix`` module. This was not imported into the pandas namespace in any event (:issue:`12111`)
- Removal of ``cols`` keyword in favor of ``subset`` in ``DataFrame.duplicated()`` and ``DataFrame.drop_duplicates()`` (:issue:`6680`)

- Removal of the ``read_frame`` and ``frame_query`` (both aliases for ``pd.read_sql``)
functions in the ``pd.io.sql`` namespace, deprecated since 0.14.0 (:issue:`6292`).

.. _whatsnew_0180.performance:

Expand Down
18 changes: 0 additions & 18 deletions pandas/io/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1708,24 +1708,6 @@ def get_schema(frame, name, flavor='sqlite', keys=None, con=None, dtype=None):

# legacy names, with depreciation warnings and copied docs

@Appender(read_sql.__doc__, join='\n')
def read_frame(*args, **kwargs):
"""DEPRECATED - use read_sql
"""
warnings.warn("read_frame is deprecated, use read_sql", FutureWarning,
stacklevel=2)
return read_sql(*args, **kwargs)


@Appender(read_sql.__doc__, join='\n')
def frame_query(*args, **kwargs):
"""DEPRECATED - use read_sql
"""
warnings.warn("frame_query is deprecated, use read_sql", FutureWarning,
stacklevel=2)
return read_sql(*args, **kwargs)


def write_frame(frame, name, con, flavor='sqlite', if_exists='fail', **kwargs):
"""DEPRECATED - use to_sql
Expand Down
24 changes: 9 additions & 15 deletions pandas/io/tests/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,6 @@ def test_read_sql_view(self):
"SELECT * FROM iris_view", self.conn)
self._check_iris_loaded_frame(iris_frame)

def test_legacy_read_frame(self):
with tm.assert_produces_warning(FutureWarning):
iris_frame = sql.read_frame(
"SELECT * FROM iris", self.conn)
self._check_iris_loaded_frame(iris_frame)

def test_to_sql(self):
sql.to_sql(self.test_frame1, 'test_frame1', self.conn, flavor='sqlite')
self.assertTrue(
Expand Down Expand Up @@ -2239,7 +2233,7 @@ def test_write_row_by_row(self):

self.conn.commit()

result = sql.read_frame("select * from test", con=self.conn)
result = sql.read_sql("select * from test", con=self.conn)
result.index = frame.index
tm.assert_frame_equal(result, frame)

Expand All @@ -2254,7 +2248,7 @@ def test_execute(self):
sql.execute(ins, self.conn, params=tuple(row))
self.conn.commit()

result = sql.read_frame("select * from test", self.conn)
result = sql.read_sql("select * from test", self.conn)
result.index = frame.index[:1]
tm.assert_frame_equal(result, frame[:1])

Expand Down Expand Up @@ -2328,7 +2322,7 @@ def test_na_roundtrip(self):

def _check_roundtrip(self, frame):
sql.write_frame(frame, name='test_table', con=self.conn)
result = sql.read_frame("select * from test_table", self.conn)
result = sql.read_sql("select * from test_table", self.conn)

# HACK! Change this once indexes are handled properly.
result.index = frame.index
Expand All @@ -2340,7 +2334,7 @@ def _check_roundtrip(self, frame):
frame2 = frame.copy()
frame2['Idx'] = Index(lrange(len(frame2))) + 10
sql.write_frame(frame2, name='test_table2', con=self.conn)
result = sql.read_frame("select * from test_table2", self.conn,
result = sql.read_sql("select * from test_table2", self.conn,
index_col='Idx')
expected = frame.copy()
expected.index = Index(lrange(len(frame2))) + 10
Expand Down Expand Up @@ -2402,7 +2396,7 @@ def test_onecolumn_of_integer(self):
# it should not fail, and gives 3 ( Issue #3628 )
self.assertEqual(the_sum, 3)

result = sql.read_frame("select * from mono_df", con_x)
result = sql.read_sql("select * from mono_df", con_x)
tm.assert_frame_equal(result, mono_df)

def test_if_exists(self):
Expand Down Expand Up @@ -2542,7 +2536,7 @@ def test_write_row_by_row(self):

self.conn.commit()

result = sql.read_frame("select * from test", con=self.conn)
result = sql.read_sql("select * from test", con=self.conn)
result.index = frame.index
tm.assert_frame_equal(result, frame)

Expand Down Expand Up @@ -2577,7 +2571,7 @@ def test_execute(self):
sql.execute(ins, self.conn, params=tuple(row))
self.conn.commit()

result = sql.read_frame("select * from test", self.conn)
result = sql.read_sql("select * from test", self.conn)
result.index = frame.index[:1]
tm.assert_frame_equal(result, frame[:1])

Expand Down Expand Up @@ -2668,7 +2662,7 @@ def _check_roundtrip(self, frame):
cur.execute(drop_sql)
sql.write_frame(frame, name='test_table',
con=self.conn, flavor='mysql')
result = sql.read_frame("select * from test_table", self.conn)
result = sql.read_sql("select * from test_table", self.conn)

# HACK! Change this once indexes are handled properly.
result.index = frame.index
Expand All @@ -2688,7 +2682,7 @@ def _check_roundtrip(self, frame):
cur.execute(drop_sql)
sql.write_frame(frame2, name='test_table2',
con=self.conn, flavor='mysql')
result = sql.read_frame("select * from test_table2", self.conn,
result = sql.read_sql("select * from test_table2", self.conn,
index_col='Idx')
expected = frame.copy()

Expand Down

0 comments on commit 541e0e7

Please sign in to comment.