From 6f1a3cc5e255fa2f2c08701e5f04733b91aa19c3 Mon Sep 17 00:00:00 2001 From: Yashpal Ahlawat Date: Tue, 27 Feb 2024 09:51:36 +0530 Subject: [PATCH 1/2] RT03 fix for read_sql method --- ci/code_checks.sh | 1 - pandas/io/sql.py | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 875e328110aaf..9d773ade8cd8d 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -1092,7 +1092,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.read_orc\ pandas.read_sas\ pandas.read_spss\ - pandas.read_sql\ pandas.read_sql_query\ pandas.read_stata\ pandas.set_eng_float_format\ diff --git a/pandas/io/sql.py b/pandas/io/sql.py index 5a16b1c8cbc24..3d1d471c249f5 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -608,6 +608,8 @@ def read_sql( Returns ------- DataFrame or Iterator[DataFrame] + Returns a single DataFrame if applicable, or an Iterator + containing multiple DataFrames. See Also -------- @@ -625,7 +627,7 @@ def read_sql( Examples -------- Read data from SQL via either a SQL query or a SQL tablename. - When using a SQLite database only SQL queries are accepted, + When using a SQLite database, only SQL queries are accepted, providing only the SQL tablename will result in an error. >>> from sqlite3 import connect From 30055b809a089b10646d917cb3f9b845427a0dd5 Mon Sep 17 00:00:00 2001 From: Yashpal Ahlawat Date: Tue, 27 Feb 2024 21:22:51 +0530 Subject: [PATCH 2/2] Review suggestions implemented --- pandas/io/sql.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pandas/io/sql.py b/pandas/io/sql.py index 3d1d471c249f5..7764a810bbda6 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -608,8 +608,9 @@ def read_sql( Returns ------- DataFrame or Iterator[DataFrame] - Returns a single DataFrame if applicable, or an Iterator - containing multiple DataFrames. + Returns a DataFrame object that contains the result set of the + executed SQL query or an SQL Table based on the provided input, + in relation to the specified database connection. See Also -------- @@ -627,7 +628,7 @@ def read_sql( Examples -------- Read data from SQL via either a SQL query or a SQL tablename. - When using a SQLite database, only SQL queries are accepted, + When using a SQLite database only SQL queries are accepted, providing only the SQL tablename will result in an error. >>> from sqlite3 import connect