Which of the following command is NOT valid to fetch data from the table of the database?
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.
Related questions:
2026: 23 May Shift 2
2026: 31 May Shift 1
2026: 31 May Shift 1