CAS.read_sql(self, sql, con, casout=None, **kwargs)

Read SQL query or database table into a CAS table

This method calls pandas.read_sql() with the given arguments, then uploads the resulting pandas.DataFrame to a CAS table.


SQL to be executed or table name.

conSQLAlchemy connectable (or database string URI)

Database connection.

casoutstring or CASTable, optional
The output table specification. This includes the following parameters.
namestring, optional

Name of the output CAS table.

caslibstring, optional

CASLib for the output CAS table.

labelstring, optional

The label to apply to the output CAS table.

promoteboolean, optional

If True, the output CAS table will be visible in all sessions.

replaceboolean, optional

If True, the output CAS table will replace any existing CAS. table with the same name.

**kwargsany, optional

Keyword arguments to pandas.read_sql().



The data from the database will be pulled to the client machine in the form of a pandas.DataFrame then uploaded to CAS. If you are moving large amounts of data, you may want to use a direct database connecter from CAS.


>>> conn = swat.CAS()
>>> tbl = conn.read_sql('select * from iris', dbcon)
>>> print(tbl.head())