Skip to main contentSkip to solution

Which of the following command is NOT valid to fetch data from the table of the database?

Solution

✅ Correct Option: 4

pandas.read_sql() accepts a single SQL query string or a table name as its first argument. Option 4 passes a list containing a set, [{query, table}], which is not a valid input, so it fails.


Option 2: read_sql_table is valid, but it only takes a table name and needs an SQLAlchemy connectable, not a raw DBAPI connection.

Option 1 runs a query string, and Option 3 is the general wrapper that handles either a query or a table name, so both are valid.

Keyboard Shortcuts

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