Skip to content

Commit fac94df

Browse files
Improved documentation for read_sql_query with clear explanation and example
1 parent ba78c72 commit fac94df

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/source/api.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,25 @@ Amazon Athena
151151
list_prepared_statements
152152
delete_prepared_statement
153153

154+
read_sql_query(sql, con, **kwargs)
155+
----------------------------------
156+
157+
Executes a SQL query and returns the result as a Pandas DataFrame.
158+
159+
**Example**:
160+
161+
.. code-block:: python
162+
163+
import awswrangler as wr
164+
import sqlalchemy
165+
166+
# Create SQLAlchemy engine for MySQL
167+
engine = sqlalchemy.create_engine("mysql+pymysql://user:password@host/dbname")
168+
169+
# Run SQL query and get results into Pandas DataFrame
170+
df = wr.read_sql_query("SELECT * FROM employees", con=engine)
171+
172+
154173
Amazon Redshift
155174
---------------
156175

0 commit comments

Comments
 (0)