SQL Queries¶
Various custom functions allow SQL queries to be executed while importing data (e.g. csvToTable ).
Knowing which table name to use¶
When using a Python-based calculation engine,
sqldf is used to apply the SQL query to the dataset before importing. The table name
will be df
(meaning "DataFrame"). For example:
select a, b from df
select * from df where c = 5
When using a VBA-based calculation engine, the actual filename is used as the table name. For example:
select a, b from data.csv
select * from data.csv where c = 5
This filename is often not known when building the model, or is set in a separate configuration. For this reason, we support shorthand queries.
Shorthand queries¶
When the Query
starts with WHERE
or ORDER BY
, the correct table name will automatically be prepended. For example
the query where c = 5
will automatically be converted to:
select * from df where c = 5
for Python-based calculation engines.select * from data.csv where c = 5
for VBA-based calculation engines, assuming the filename isdata.csv
.