read_sql

read_sql is a method used to execute a SQL query on a database and read the result directly into a table.

Syntax

Parameters

ParameterTypeDescription
connany

The database connection. Can be either a connection string for the given driver or a Connection object.

querystr

The SQL query to execute on the database.

driver optionalstr

The driver to use. Supported drivers are odbc, adbc, and connectorx. connectorx is the default. This argument will be ignored if conn is a Connection object.

Returns

A new table.

Examples

The following example uses read_sql to execute a SQL query on a Postgres DB via the connectorx driver. The result of the query is a new in-memory table.

The above crypto_trades table