Skip to content

Commit 82ff533

Browse files
Address comments
1 parent 98eecb1 commit 82ff533

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

pandas/io/sql.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,12 @@ def read_sql(
485485
486486
Examples
487487
--------
488-
Read data from SQL via either a SQL query or a SQL tablename (latter not
489-
possible for SQLite tables)
488+
Read data from SQL via either a SQL query or a SQL tablename.
489+
When using a SQLite database only SQL queries are accepted,
490+
providing only the SQL tablename will result in an error.
491+
490492
>>> from sqlite3 import connect
491-
>>> conn = connect('file.db')
493+
>>> conn = connect(':memory:')
492494
>>> df = pd.DataFrame(data=[[0, '10/11/12'], [1, '12/11/10']],
493495
... columns=['int_column', 'date_column'])
494496
>>> df.to_sql('test_data', conn)
@@ -500,12 +502,12 @@ def read_sql(
500502
501503
>>> pd.read_sql('test_data', 'postgres:///db_name') # doctest:+SKIP
502504
503-
Apply dateparsing to columns through the ``parse_dates`` argument
505+
Apply date parsing to columns through the ``parse_dates`` argument
504506
505507
>>> pd.read_sql('SELECT int_column, date_column FROM test_data',
506508
... conn,
507509
... parse_dates=["date_column"])
508-
int_column date_column
510+
int_column date_column
509511
0 0 2012-10-11
510512
1 1 2010-12-11
511513
@@ -517,11 +519,11 @@ def read_sql(
517519
>>> pd.read_sql('SELECT int_column, date_column FROM test_data',
518520
... conn,
519521
... parse_dates={"date_column": {"errors": "ignore"}})
520-
int_column date_column
522+
int_column date_column
521523
0 0 2012-10-11
522524
1 1 2010-12-11
523525
524-
2. Apply a dayfirst dateparsing order on the values of "date_column"
526+
2. Apply a dayfirst date parsing order on the values of "date_column"
525527
526528
>>> pd.read_sql('SELECT int_column, date_column FROM test_data',
527529
... conn,
@@ -530,12 +532,12 @@ def read_sql(
530532
0 0 2012-11-10
531533
1 1 2010-11-12
532534
533-
3. Apply custom formatting when dateparsing the values of "date_column"
535+
3. Apply custom formatting when date parsing the values of "date_column"
534536
535537
>>> pd.read_sql('SELECT int_column, date_column FROM test_data',
536538
... conn,
537539
... parse_dates={"date_column": {"format": "%d/%m/%y"}})
538-
int_column date_column
540+
int_column date_column
539541
0 0 2012-11-10
540542
1 1 2010-11-12
541543
"""

0 commit comments

Comments
 (0)