pandas.read_sql_table

pandas 3.1.1 · Input and output · function

Load columns from a named SQL database table.

Call syntax

pd.read_sql_table(…) Full signature
pd.read_sql_table(
    table_name,
    con,
    schema=None,
    index_col=None,
    coerce_float=True,
    parse_dates=None,
    columns=None,
    chunksize=None,
    dtype_backend=…,
)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
table_name Required
Positional or keyword
str
con Required
Positional or keyword
SQLAlchemy connectable or str

Provide a database connection or supported SQLAlchemy connectable.

schema Optional
Positional or keyword
Default None
str

Provide the schema defining the field names and types.

index_col Optional
Positional or keyword
Default None
str or list of str

Identify the column or columns whose values should become the row index.

coerce_float Optional
Positional or keyword
Default True
bool

Attempt to convert compatible nonfloating values to floating-point values.

parse_dates Optional
Positional or keyword
Default None
list or dict

Choose whether to interpret selected fields as dates during a read.

columns Optional
Positional or keyword
Default None
list

Supply column labels or control how columns are handled.

chunksize Optional
Positional or keyword
Default None
int

Set how many rows to read or write in each batch.

dtype_backend Optional
Positional or keyword
{'numpy_nullable', 'pyarrow'}

Choose nullable NumPy-backed dtypes or Arrow-backed dtypes.

Returns

DataFrame or Iterator[DataFrame]