Skip to main contentSkip to solution

___________ is used to read either an sql query or an sql table into a DataFrame using the connection identifier (sql_conn).

Solution

✅ Correct Option: 3

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.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question