___________ is used to read either an sql query or an sql table into a DataFrame using the connection identifier (sql_conn).
___________ is used to read either an sql query or an sql table into a DataFrame using the connection identifier (sql_conn).
Solution
pandas.read_sql(sql, sql_conn) is a wrapper function that accepts either a SQL query string or a table name. It internally calls read_sql_query for a query and read_sql_table for a table, so it covers both cases through one connection.
Option 1: read_sql_query reads only a SQL query, not a table name.
Option 2: read_sql_table reads only a whole table, not a query. It also needs an SQLAlchemy connectable, not a plain DBAPI connection.
Option 4: it uses the right function, but read_sql has no argument named sql_table. Its first parameter is named sql, as in Option 3.
Related questions:
2025: 14 May Shift 1
2025: 15 May Shift 2