RSqliteDS is an RDF data source implementation for SQL result sets from sqlite3 files.
RDataFrame data source class for reading SQlite files.
The RSqliteDS is able to feed an RDataFrame with data from a SQlite SELECT query. One can use it like
auto rdf = ROOT::RDF::MakeSqliteDataFrame("/path/to/file.sqlite", "select name from table");
auto h = rdf.Define("lName", "name.length()").Histo1D("lName");
The data source has to provide column types for all the columns. Determining column types in SQlite is tricky as it is dynamically typed and in principle each row can have different column types. The following heuristics is used:
- If a table column is queried as is ("SELECT colname FROM table"), the default/declared column type is taken.
- For expressions ("SELECT 1+1 FROM table"), the type of the first row of the result set determines the column type. That can result in a column to be of thought of type NULL where subsequent rows actually have meaningful values. The provided SELECT query can be used to avoid such ambiguities.
Definition at line 53 of file RSqliteDS.hxx.
const std::vector< std::string > & ROOT::RDF::RSqliteDS::GetColumnNames |
( |
| ) |
const |
|
finalvirtual |
Returns the SELECT queries names.
The column names have been cached in the constructor. For expressions, the column name is the string of the expression unless the query defines a column name with as like in "SELECT 1 + 1 as mycolumn FROM table"
Implements ROOT::RDF::RDataSource.
Definition at line 487 of file RSqliteDS.cxx.