Executes an SQL query on the OMOP CDM.

Parameters:statement (sqlalchemy object or string) –
sqlalchemy objects - statements can be created using sqlalchemy objects such as select, insert, etc. and the underlying table structures from Inspector.tables
e.g. select([concept]).where(concept.concept_id==0)
strings - can be a string containing an SQL statemment such as
e.g. ‘SELECT concept_name from concept where concept_id = 0’
Returns:results – The results object is a subclass of SQLAlchemy results_proxy with extra methods for retrieving the results as pandas DataFrames. Traditional methods conforming to the python DB connection spec work as well e.g. fetchone, fetchmany, fetchall
Return type:inspectomop.Results


* Use of raw SQL strings is not recommended as they bypass the dialect translation and security provided by using SQLAlchemy *

See also

inpsectomop.Results(), inspectomop.queries()