This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Data Connections

Querying data held outside Stroom’s own stores: a JDBC database, Amazon Athena or an LDAP directory, or CSV and Excel data held in the document itself.

A Data Connection is one more kind of data source . It lets StroomQl queries, Dashboards and scheduled analytic rules query data that Stroom does not hold in its own indexes or stores, such as a reporting database or a staff directory. Once its rows reach Stroom, every part of StroomQL works on them as it does on any other data source, e.g. where, eval, group by, sort by and select.

Data Connections are read-only. Stroom never writes to the systems they connect to, and cannot join one data source to another.

Types

Each Data Connection has a Type, which decides where its data comes from and how it is queried.

Type Data Queried with Fields
JDBC A database reached through a JDBC driver, e.g. MySQL or PostgreSQL. SQL in each query’s sql clause. The columns the SQL returns.
Amazon Athena Amazon Athena, reached through the AWS SDK. SQL in each query’s sql clause. The columns the SQL returned when it last ran.
LDAP An LDAP directory, e.g. OpenLDAP or Active Directory. An LDAP search filter in each query’s sql clause. dn and the attributes listed in the document.
CSV CSV text held in the document. Stroom’s own clauses only. The columns listed in the document.
Excel An Excel .xlsx workbook held in the document. Stroom’s own clauses only. The columns listed in the document.

The pages for each type describe its settings. The rest of this page applies to them all.

Creating a Data Connection

  1. Right-click a folder in the Stroom Explorer pane ( ).
  2. Select:
    New
    Data Connection
  3. Enter a name for the Data Connection and click OK . Queries name it after from, so a short name without spaces is easiest to type.
  4. On the Settings tab, choose the Type and fill in the settings that appear below it.
  5. Click Test Connection , or for CSV and Excel Check CSV or Check Workbook , to check the settings.
  6. Click .

The settings of every type are kept when you change the Type, so you can switch back without losing them. Only the settings of the chosen type are checked and used.

Settings an administrator controls, such as which JDBC URLs are allowed, are checked when you save, so a mistake is reported straight away. They are checked again whenever the Data Connection connects, as an imported document is not checked on import.

Settings for Every Type

Time Column (optional)
A date column of the data, used to apply a query’s time range. See Time Range. Not used by Amazon Athena.
Query Timeout (seconds)
How long a query may run before it is stopped. An administrator may set a lower ceiling. Not used by CSV and Excel, which are read from the document. Default: 60.
Max Rows
The most rows a query may read. A query with more uses the first ones and warns that the limit was reached. An administrator may set a lower ceiling. Default: 100000.

Querying a Data Connection

Name the Data Connection after from, as for any other data source. For CSV and Excel that is all that is needed, as the data is held in the document, e.g.

from "Teams"
where on_call = true
sort by members desc
select team, members

JDBC, Amazon Athena and LDAP Data Connections also need the query to run in the external system: SQL for JDBC and Athena, or a search filter for LDAP. It goes in a sql clause straight after from, as a string in triple double quotes ("""). A triple-quoted string is taken exactly as written, so it can span lines and hold " and \ without escaping, e.g.

from "Stroom DB"
sql """
  select f.name as feed, t.name as type
  from meta m
  join meta_feed f on f.id = m.feed_id
  join meta_type t on t.id = m.type_id
"""
eval streams = count()
group by feed, type
sort by streams desc
select feed, type, streams

The SQL or filter runs first, in the external system. Its rows then go through the rest of the query in Stroom, like the rows of any other data source. So keep the SQL or filter to what narrows the data, and let Stroom’s clauses do the rest, or do as much as the external system can do faster, as you prefer.

A sql clause is refused for a data source that does not take one, and a JDBC, Athena or LDAP Data Connection without one is refused with an example of the clause.

Fields

The fields of a query are the columns of the rows its data source gives:

  • JDBC: the columns of the SQL. Stroom asks the database to describe the SQL without running it, so the fields are known as you type.
  • Amazon Athena: the columns of the SQL when it last ran, as Athena cannot describe a query without running it and every run is billed. Until the SQL has run once, the field list is empty.
  • LDAP: dn, then each attribute listed in the document.
  • CSV and Excel: the columns listed in the document.

A field the query uses that the data does not have is empty, and the query warns about it. A field used in where that is not a column is an error.

Parameters

The SQL or filter can take values from the query’s parameters, such as those of a dashboard, with a named placeholder: a colon followed by the parameter’s name, e.g. :feed.

from "Stroom DB"
sql """
  select m.id, m.create_time
  from meta m
  join meta_feed f on f.id = m.feed_id
  where f.name = :feed
"""
select id, create_time

A value is never pasted into the SQL or filter as text, so it cannot change it:

  • JDBC binds it as a parameter of a prepared statement.
  • Amazon Athena passes it as an execution parameter, written as a single SQL literal. As Athena receives every value as text, compare it with a number by casting, e.g. where id = cast(:id as bigint).
  • LDAP escapes it as a filter value, so *)(uid=* is matched as text and finds nothing.

A placeholder with no parameter of its name is an error. SQL must use named placeholders: a ? outside quotes is refused.

Time Range

A query’s time range can be applied in two ways.

In the SQL or filter, with the placeholders :from and :to, which take the start and end of the time range, e.g.

select * from events where event_time >= :from and event_time < :to

By default they are timestamps. A format in braces after the name changes them:

Placeholder Value
:from A timestamp for JDBC and Athena, or an LDAP time (GeneralizedTime) for LDAP.
:from{epochMillis} Milliseconds since 1970, as Stroom’s own tables hold times.
:from{epochSeconds} Seconds since 1970.
:from{yyyy-MM-dd} Text in the given date pattern, in UTC.

In Stroom, on the document’s Time Column, when the SQL or filter has no :from or :to. The SQL must return the column, and for LDAP, CSV and Excel it must be a Date column or attribute. This reads every row the SQL or filter returns, so filtering in the SQL is faster on large data.

If neither applies, the time range is ignored and the query warns that it was.

Amazon Athena bills by the data each query scans, so an Athena query with a time range must use :from or :to in its SQL, and is refused otherwise.

Limits and Warnings

A query stops when it has read the document’s Max Rows or runs for its Query Timeout, whichever comes first. An administrator’s ceilings on both apply to every Data Connection.

Problems that do not stop a query are reported as warnings with its results, e.g.:

  • The row limit was reached, so only the first rows were used.
  • The time range was ignored.
  • A field the query uses is not a column of the data.
  • Values were not of their column’s type, so they are empty. The warning counts them and gives an example.
  • For LDAP, a referral was not followed, or the directory’s own size or time limit ended the search.

Closing or stopping a query stops it in the external system too.

Dashboards

A Data Connection can be the data source of a dashboard’s Query panel. CSV and Excel need nothing more.

For JDBC, Amazon Athena and LDAP the query needs its sql clause, which the Query panel’s expression editor has no place for. Write the query in a Query document instead, and show it on the dashboard with an Embedded Query panel.

A dashboard that refreshes automatically reruns the query each time, against the external system. The Minimum Refresh (minutes) setting of JDBC, Amazon Athena and LDAP Data Connections sets the shortest interval at which a dashboard may do so, to protect the system and, for Athena, the cost. A dashboard set to refresh more often is held to the minimum.

Analytics

Scheduled Query rules and Report documents can query a Data Connection. Each run applies the rule’s time range to the time it runs for, using :from and :to or the Time Column as above.

Streaming and table builder rules run over events as Stroom processes them, through a View . A View cannot use a Data Connection, so these rules cannot either.

Permissions

To query a Data Connection a user needs Use permission on the document.

JDBC, LDAP and Amazon Athena Data Connections name a credential to connect with. The credential is used as the user running the query, who needs Use permission on the credential too. A credential that does not exist and one the user may not use give the same error, so the names of credentials cannot be discovered this way.

Testing a connection, and detecting the columns or attributes of the data, use the settings being edited with the credential they name. So they need permission to edit the document as well.

Administration

An administrator controls what Data Connections may connect to with these properties, under stroom.dataConnection. See Properties.

Property Default Purpose
allowedUrlPatterns None Regular expressions a JDBC URL must match one of. With none, no JDBC connection is allowed.
deniedConnectionProperties A list of MySQL and PostgreSQL properties JDBC driver properties a Data Connection may not set, in its URL or its connection properties, because they can read local files, load classes or turn off read-only connections.
driverDirectory None A directory of extra JDBC driver jars, for databases other than MySQL and PostgreSQL, whose drivers Stroom ships. Needs a restart.
allowedAthenaWorkGroups None Regular expressions an Amazon Athena region/workgroup must match one of, e.g. ^eu-west-2/stroom-.*$. With none, no Athena connection is allowed.
allowedAthenaOutputLocations None Regular expressions an Athena output location must match one of. With none, Data Connections may not set one and the workgroup’s is used.
allowDefaultAwsCredentials false Whether an Athena Data Connection with no credential may use Stroom’s own AWS identity.
allowedLdapUrlPatterns None Regular expressions an LDAP URL must match one of, e.g. ^ldaps://directory\.example\.org:636$. With none, no LDAP connection is allowed.
allowPlainLdap false Whether an LDAP Data Connection may connect with plain ldap:// and no StartTLS, sending its password and results unencrypted.
maxStoredDataSize 5M (5 MiB) The most CSV or Excel data a Data Connection may hold.
maxQueryTimeout PT10M The longest query timeout a Data Connection may set.
maxRowsLimit 1000000 The highest row limit a Data Connection may set.
maxPoolSizeLimit 20 The largest JDBC connection pool a Data Connection may set.
connectionPoolCache 100 pools, closed after 10 minutes unused The JDBC connection pools, one per Data Connection.
fieldCache 1000 entries for 10 minutes The columns of each query’s SQL, so editors can list fields without asking the database each time.
tableCache 10 entries, for 10 minutes unused The rows read from the CSV or Excel data of each Data Connection.

With the defaults, no JDBC, Athena or LDAP connection is allowed until an administrator allows one. CSV and Excel Data Connections need no setting.

Example Pack

The Stroom repository holds an import pack of example Data Connections and queries, stroom-data-connection/DataConnection-Examples.zip, for trying them out in a development or test Stroom. Import it with:

Tools
Import

It imports a Data Connection Examples folder holding:

  • Stroom DB, a JDBC Data Connection pointed at Stroom’s own MySQL database, with queries of its nodes, streams and processor tasks.
  • Teams, a CSV Data Connection, and Bank Holidays, an Excel one, each with a query. They need no set-up.
  • People, a CSV Data Connection, and ten Join - … queries that join it to Teams and Bank Holidays: a left join, a semi join with a condition on the joined source, an anti join, a join to a bracketed grouped query, a join on a date, where exists, where not exists, where ... in, a right join and a full outer join. They need no set-up either, see Joins.
  • Directory, an LDAP Data Connection, with queries of the people in a directory.

The Documentation tab of each JDBC and LDAP Data Connection gives its set-up steps. Change its URL to your own database or directory first, as the queries will otherwise read a different one, or none.

1 - JDBC Data Connections

Querying a database with SQL through a JDBC driver.

A JDBC Data Connection connects to a database through a JDBC driver. Each query gives the SQL to run in a sql clause, and the columns of its result become the query’s fields.

Stroom ships the MySQL and PostgreSQL drivers. An administrator can add drivers for other databases by putting their jars in the directory named by the stroom.dataConnection.driverDirectory property.

Settings

JDBC URL
The JDBC URL of the database, e.g. jdbc:mysql://reporting-db:3306/reports. It must match one of the patterns an administrator has allowed in the stroom.dataConnection.allowedUrlPatterns property. Do not put a user name or password in it; choose a credential instead.
Credential
The Username / Password credential to connect with. You need Use permission on it, as does anyone who queries this Data Connection.
Connection Properties
Extra JDBC driver properties, one name=value per line. For MySQL, add useCursorFetch=true so large results are read in batches of the fetch size rather than all at once.
Max Pool Size
The most connections Stroom keeps open to this database at once. An administrator may set a lower ceiling. Default: 5.
Fetch Size
How many rows are fetched from the database in each round trip. 0 uses the driver’s own default. Default: 1000.
Minimum Refresh (minutes)
The shortest interval at which a dashboard may rerun a query of this Data Connection automatically, to limit the load on the database. 0 sets no minimum beyond the dashboard’s own 10 seconds. Default: 0.

The Time Column, Query Timeout and Max Rows settings are described in Settings for Every Type.

Test Connection connects with the settings as they stand and reports the database and driver it reached, and the user it connected as.

Writing the SQL

The SQL is a single statement that returns rows, given in a triple-quoted sql clause, e.g.

from "Reports DB"
sql """
  select name, team, joined
  from staff
  where joined >= :from and joined < :to
"""
where team = "Platform"
select name, joined
  • A ; is only allowed at the end, so a query cannot run a second statement.
  • Use named placeholders such as :team for values, not ?, which is refused outside quotes. See Parameters and Time Range.
  • Give each column the name you want as its field, with as if needed, e.g. count(*) as streams. A field matches a column of the same name, or failing that a column whose name differs only in case, as some databases change the case of names that are not quoted.

Stroom asks the database to describe the SQL without running it, so the fields are listed in the query editor as you write the SQL.

Column Types

Each column is read as a Stroom field type, from the type the driver reports:

Database type Field type
TINYINT, SMALLINT, INTEGER Integer
BIGINT Long
DECIMAL and NUMERIC with no fraction and up to 18 digits Long
REAL, FLOAT Float
DOUBLE, and other DECIMAL and NUMERIC Double
BOOLEAN, BIT Boolean
DATE, TIMESTAMP, TIMESTAMP WITH TIME ZONE Date
Anything else Text

A date or timestamp with no time zone is taken as UTC. An unsigned BIGINT too large for a Long is read as a Double.

Stroom’s own tables hold times as milliseconds since 1970 in BIGINT columns. To read them as dates, convert them in the SQL, e.g. from_unixtime(create_time / 1000) in MySQL, and compare them with the time range using :from{epochMillis} and :to{epochMillis}.

Security

Stroom asks for read-only connections, turning off auto-commit so that PostgreSQL connections are read-only too. Only the database can enforce what an account may do, so the credential should be for an account that can only read the tables Stroom should query.

An administrator’s controls are checked when the Data Connection is saved and again whenever it connects:

  • The URL must match one of the stroom.dataConnection.allowedUrlPatterns patterns.
  • Embedded databases (jdbc:h2:, jdbc:hsqldb:, jdbc:derby: and jdbc:sqlite:) are refused, as they read files on the Stroom server.
  • Driver properties that can read local files, load classes or turn off read-only connections are refused, whether in the URL or the connection properties. The list is the stroom.dataConnection.deniedConnectionProperties property. For MySQL and PostgreSQL the URL is read by the driver’s own parser, so a property cannot be hidden in it. The URLs of other databases cannot contain % or (; set their properties as connection properties instead.
  • A user name or password in the URL or connection properties is refused, so a secret is never stored in the document.

2 - Amazon Athena Data Connections

Querying Amazon Athena with SQL through the AWS SDK.

An Amazon Athena Data Connection runs SQL in Amazon Athena through the AWS SDK. Each query gives the SQL to run in a sql clause, and the columns of its result become the query’s fields.

Athena bills by the data each query scans, so several settings and rules here exist to keep the cost in check.

Settings

AWS Region
The AWS region of the Athena workgroup, e.g. eu-west-2.
Workgroup
The Athena workgroup queries run in. The region and workgroup, written region/workgroup, must match one of the patterns an administrator has allowed in the stroom.dataConnection.allowedAthenaWorkGroups property. The workgroup’s per-query data scan limit is the control on cost. Default: primary.
Data Catalog
The data catalog queries run in. Default: AwsDataCatalog.
Database
The database queries run in. Default: default.
Output Location (optional)
The S3 URI query results are written to, e.g. s3://my-bucket/athena/. Leave it empty to use the workgroup’s. It must match one of the patterns an administrator has allowed in the stroom.dataConnection.allowedAthenaOutputLocations property; with none, it must be left empty.
Credential
The AWS Access Key credential to query with. You need Use permission on it, as does anyone who queries this Data Connection. With none, Stroom’s own AWS identity is used, but only if an administrator has turned on the stroom.dataConnection.allowDefaultAwsCredentials property.
Result Reuse (minutes)
How old a result of the same query may be and still be reused instead of running the query again. Athena bills every run, so this saves cost when the same query is run again. 0 never reuses a result. Default: 0.
Minimum Refresh (minutes)
The shortest interval at which a dashboard may rerun a query of this Data Connection automatically. Result reuse rarely helps a dashboard, as its time range changes on every refresh, and many refreshes also use up the account’s limit on Athena queries running at once. 0 sets no minimum beyond the dashboard’s own 10 seconds. Default: 5.
Max Data Scanned (MB)
The most data, in MB, a query may scan before Stroom stops it. Stroom checks while the query runs, so a query may pass the limit by what it scans between two checks. The workgroup’s own per-query data scan limit is the one Athena enforces exactly, so set that too. 0 sets no limit beyond the workgroup’s. Default: 0.

The Query Timeout and Max Rows settings are described in Settings for Every Type. Athena takes the time range in its SQL, so it has no time column.

Test Connection runs no query, as every query is billed. It looks up the workgroup and the database, which checks the credential, region, workgroup and database. It reports the workgroup’s data scan limit and result location, or that none is set, and whether the workgroup enforces its own settings.

Writing the SQL

The SQL is a single statement that returns rows, given in a triple-quoted sql clause, e.g.

from "Events"
sql """
  select event_time, user_name, action
  from sign_ins
  where event_time >= :from and event_time < :to
    and outcome = 'FAILED'
"""
eval failures = count()
group by user_name
sort by failures desc
select user_name, failures
  • Only SQL that starts with SELECT, WITH, VALUES, SHOW or DESCRIBE is run, as an Athena connection cannot be made read-only. That refuses CREATE TABLE AS, INSERT and UNLOAD.
  • A ; is only allowed at the end, so a query cannot run a second statement.
  • A query with a time range must use :from or :to in its SQL, and is refused otherwise. Filtering in Stroom after Athena had scanned everything would cost money for nothing.
  • Athena receives every parameter as text, written as a single SQL literal. To compare one with a number, cast it, e.g. where id = cast(:id as bigint).

See Parameters and Time Range.

Fields

Athena cannot describe a query without running it, and every run is billed. So the fields of a query are only known once its SQL has run; until then the field list is empty. After a run, the fields are remembered for a while, so the query editor can list them.

Cost

Each run reports the data Athena scanned with its results.

A query is stopped in Athena, not just in Stroom, when it is cancelled, when it reaches the query timeout or the Max Data Scanned limit, or when Stroom fails after starting it.

Security

  • The region and workgroup must match one of the stroom.dataConnection.allowedAthenaWorkGroups patterns.
  • An output location must match one of the stroom.dataConnection.allowedAthenaOutputLocations patterns. Every query writes its full result there, with the AWS identity of the user running it.
  • A Data Connection must name an AWS access key credential, unless stroom.dataConnection.allowDefaultAwsCredentials is on. Otherwise any user who can create a document could query whatever Stroom’s own AWS identity can read.
  • Use AWS identities that can only read the tables Stroom should query. Federated queries pass SQL to connectors that Stroom cannot see into, so their accounts should only be able to read too.

3 - LDAP Data Connections

Searching an LDAP directory, such as OpenLDAP or Active Directory, with a search filter.

An LDAP Data Connection searches an LDAP directory. Each query gives an LDAP search filter in a sql clause, and each entry it finds becomes a row. The fields are dn and the attributes listed in the document.

Settings

LDAP URL
The directory’s URL: its scheme, host and port only, e.g. ldaps://directory.example.org:636. It must match one of the patterns an administrator has allowed in the stroom.dataConnection.allowedLdapUrlPatterns property. A URL that also gives a base DN, attributes, scope or filter is refused; set those in their own places.
Use StartTLS
Whether to start TLS on an ldap:// connection before binding, so the password and results are encrypted. An ldaps:// connection is always encrypted. Plain ldap:// without StartTLS can only be used if an administrator turns on the stroom.dataConnection.allowPlainLdap property. Default: off.
Credential
The Username / Password credential to bind with. Its username is the full bind DN, e.g. cn=stroom-reader,ou=Services,dc=example,dc=org. You need Use permission on it, as does anyone who queries this Data Connection. Anonymous binds are not allowed, so a credential is required, and it must have a password.
Base DN
Where searches start, e.g. ou=People,dc=example,dc=org. Queries cannot search outside it.
Scope
How far below the base DN searches reach: the base entry only, the entries directly below it, or the whole subtree. Default: the whole subtree.
Page Size
How many entries are fetched in each page of results. Default: 500.
Minimum Refresh (minutes)
The shortest interval at which a dashboard may rerun a query of this Data Connection automatically, to limit the load on the directory. 0 sets no minimum beyond the dashboard’s own 10 seconds. Default: 0.
Attributes
The attributes read from each entry, each with a type. See Attributes.

The Time Column, Query Timeout and Max Rows settings are described in Settings for Every Type.

Test Connection connects, starts TLS if set, binds and reads the base DN’s entry. It reports the directory’s vendor, and whether the directory supports paged results.

Attributes

The fields of a query are dn, which every entry has, then each attribute in the Attributes table, in order. An attribute an entry does not have is empty.

Detect Attributes reads the first 100 entries below the base DN and adds the attributes they have to the table, with the type their values suggest. Attributes already in the table stay, in their place and with their type, so a type you chose survives detecting the attributes again. It also asks for createTimestamp and modifyTimestamp, which most directories keep but only return when asked for by name.

Directories return some attributes only when asked for by name, such as operational attributes, and an attribute may only be on later entries. Add these to the table by name, and remove the ones you do not need, as each attribute is fetched from the directory for every entry.

Each attribute is read as its type:

Type Reads
Text Any attribute. An attribute with several values, such as memberOf, gives them all, joined by ; . Binary values, such as objectGUID, are given in base64.
Long, Double A number.
Boolean TRUE or FALSE, as LDAP writes them, in any case.
Date An LDAP time (GeneralizedTime), such as createTimestamp or whenCreated, or an Active Directory FILETIME number, such as lastLogonTimestamp or pwdLastSet. A FILETIME of 0, or the largest possible value, means no time and is empty.

An attribute with more than one value, or a binary value, can only be read as Text. A value that is not of its attribute’s type is empty, and the query warns about it. Detect Attributes suggests Date only for LDAP times, so set FILETIME attributes to Date yourself.

Writing the Filter

The filter is a standard LDAP search filter, given in a triple-quoted sql clause, e.g.

from "Directory"
sql """
(&(objectClass=person)(departmentNumber=:department))
"""
sort by cn
select cn, uid, mail

The brackets around a filter may be left off, e.g. objectClass=person.

A placeholder takes the value of the query parameter of its name, and :from and :to take the time range as LDAP times, e.g. (modifyTimestamp>=:from). See Parameters and Time Range.

Each value is escaped as an LDAP filter value, so it can only ever be matched and never change the filter.

  • A colon also appears in extensible match filters, such as (cn:caseExactMatch:=Fred), and in values such as times and URLs. So a colon only starts a placeholder where a value starts, straight after =, ~=, >= or <=, or after a * wildcard. A value that must start with a colon followed by a letter writes the colon as \3a.
  • Values are escaped for the filter, not for a DN. So in a DN-valued filter such as (member=uid=:user,ou=People,dc=example,dc=org), a parameter holding a comma could compare a different DN, though never change the filter. Give the whole DN as one parameter instead, e.g. (member=:memberDn).

Searching

  • Entries are fetched a page at a time with the simple paged results control, so a search can read more entries than the directory returns at once. The control is not marked critical, so a directory without it still answers, within its own size limit.
  • The search stops at the Data Connection’s Max Rows.
  • If the directory’s own size or time limit for the bind account ends a search, the query keeps the entries read so far and warns. Narrow the filter, or ask the directory’s administrator to raise the limit.
  • Referrals to other servers are not followed, as the allowed LDAP URLs may not include them. The query warns how many there were. Search those servers with Data Connections of their own.

Security

  • The URL must match one of the stroom.dataConnection.allowedLdapUrlPatterns patterns.
  • The connection must be encrypted, with ldaps:// or StartTLS, unless stroom.dataConnection.allowPlainLdap is on. Plain LDAP sends the bind password and every result unencrypted, so only use it for test directories.
  • The directory’s certificate must be trusted by Stroom’s Java trust store and name the host in the URL.
  • Directories hold personal data, so use a bind account the directory lets read only the entries and attributes Stroom needs.
  • Stroom’s LDAP client never turns what a directory returns into Java objects, so a directory cannot make Stroom load code.

Active Directory

Active Directory names some attributes differently from the standard inetOrgPerson ones, e.g.:

Standard Active Directory
uid sAMAccountName
departmentNumber department
createTimestamp whenCreated
modifyTimestamp whenChanged

Its global catalog, on ports 3268 and 3269, can search a whole forest without referrals. Times such as lastLogonTimestamp, pwdLastSet and accountExpires are FILETIME numbers: set their type to Date to read them as dates.

4 - CSV and Excel Data Connections

Querying CSV text or an Excel workbook held in the Data Connection itself.

A CSV or Excel Data Connection holds its data in the document itself, so it needs no connection and no credential. It suits small lookup tables and reference lists, such as teams, sites or holidays, that queries and dashboards can use alongside Stroom’s own data. Bulk data belongs in a Feed .

The data is queried with Stroom’s own clauses alone, so a query has no sql clause, e.g.

from "Bank Holidays"
where region = "All" or region = "Scotland"
sort by date
select date, holiday

The data is held, exported and imported with the document. An export keeps it in a file of its own beside the document’s JSON: the CSV as text, in a .csv file, and the workbook as the original .xlsx file.

An administrator sets the most data a Data Connection may hold with the stroom.dataConnection.maxStoredDataSize property, 5M (5 MiB) by default. Saving more is refused.

Columns

The fields of a query are the columns in the document’s Columns table, in the order their values appear in each row. Each column has a name, which becomes the field name, and a type, which its values are read as:

Type Values
Text Anything, kept as it is.
Long Whole numbers.
Double Numbers that may have a fraction.
Date Dates and times in ISO 8601 with a four-digit year, e.g. 2026-11-12 or 2026-11-12T09:30:00Z. A space may stand for the T. A time with no zone is taken as UTC; a zone is Z or an offset such as +01:00, +0100 or +01.
Boolean true or false, in any case.

A value that is not of its column’s type is empty, and the query warns about it, giving the number of such values and an example.

Detect Columns reads the first 1,000 rows and fills in the table:

  • Each column is named from the header row, if there is one. A column with no name in the header, or with no header row, is named column1, column2 and so on, and a repeated name has a suffix added, as each column needs a field name of its own. Names that differ only in case, such as Team and team, count as repeated, as fields are matched without regard to case.
  • Each column’s type is guessed from its values: the narrowest of Long, Double, Date and Boolean that all of them are, or else Text. Numbers that would lose something as a number stay Text, such as codes with leading zeros, e.g. 0123, and whole numbers too big for a Long, such as long identifiers.
  • A column already in the table keeps the type you chose for it, even if the case of its name in the header has changed, so you can detect the columns again after changing the data.

If the header row no longer matches the columns in the table, because the data changed after they were detected, a query warns that values may be under the wrong fields. Detect the columns again.

CSV

Delimiter
The character between the values of each row: comma, semicolon, tab or pipe. Default: comma.
First Row Is A Header
Whether the first row holds the column names. Default: on.
CSV
The data. Paste it in, or click Load From File to read a file from your computer, which then detects the columns. Values are read as CSV, so a value holding the delimiter, a quote or a line break is quoted in " double quotes, with any " inside written twice.

Changing the delimiter or the header setting detects the columns again.

Check CSV reads all of the CSV and reports how many rows and columns it has, and any values that are not of their column’s type.

Excel

Workbook
The Excel workbook. Choose an .xlsx file: it is uploaded straight away, which detects the columns, and stored with the document when you save. Older .xls workbooks cannot be read; save them as .xlsx in Excel first. Download downloads the stored workbook, e.g. to edit it in Excel and upload it again. Remove removes it when you save.
Sheet (optional)
The name of the sheet to read. Leave it empty to read the first sheet.
First Row Is A Header
Whether the first row with values holds the column names. Default: on.

Excel values are read as Excel worked them out:

  • Numbers are read as plain numbers, whatever their format in Excel, e.g. 1234.5 for a cell shown as £1,234.50.
  • Dates are read as dates, including in workbooks that count dates from 1904, as older Mac versions of Excel did.
  • Formulas are read as the value Excel last worked out for them; Stroom does not work them out again.

Check Workbook reads all of the sheet and reports how many rows and columns it has, and any values that are not of their column’s type.

The browser never holds the workbook: it is uploaded to Stroom, and downloaded only when you ask.

Time Range and Other Settings

If the document names a Time Column, which must be a Date column, a query’s time range filters the rows on it. With none, the time range is ignored, and the query warns that it was.

The data only changes when the document does, so CSV and Excel Data Connections have no query timeout and no minimum refresh. The rows read are cached for each version of the document, so a dashboard that refreshes does not read the data again.