Skip to content

Data Explorer

Data Explorer is a read-only database browser for administrators, a bit like the object explorer of SQL Server Management Studio inside the application. It lists the tables and views of the connections of the application, shows their rows, columns and relationships, and follows the foreign keys from one table to another. It is at Administration / Data Explorer (~/DataExplorer), for the users with the Administration:DataExplorer permission.

Data Explorer with the Orders table open, its customer and employee columns as links

Browsing the Tables

The connections are on the left, each with its tables and views in two folders. A connection loads its tables when it is opened. The search box above them finds the tables and views of all the connections by a part of their name.

A table or a view opens in a tab on the right. Its header tells the connection, the number of rows, columns and foreign keys, and it has three sections:

  • Data: the rows, a page at a time, with sorting, a quick search in the text columns, and a filter for each column. A value of a foreign key column is a link that opens the row it refers to, e.g. the customer of an order, in the tab of that table, with a note that tells the filter and a link that shows all the rows again.
  • Columns: the name, SQL type, size, nullability and keys of each column, with a link to the table a foreign key refers to.
  • Relationships: the foreign keys of the table (References) and the ones of the other tables that refer to it (Referenced by), each with a button that opens the other table. A view has no relationships.

The relationships of the Employees table

The hash of the URL keeps the table that is shown and its filter, e.g. #table/Northwind/dbo.Orders?CustomerID=ALFKI. Following a link of a foreign key adds an entry to the history of the browser, so its Back button goes back to the table and the filter before it, and such a URL opens the table directly.

A tab closes with its × button, a middle click, or the Delete key. Its menu, opened with a right click, Shift+F10 or the … button at the end of the tab bar, closes it, the other tabs, the ones to its right, or all of them. The button at the start of the tab bar hides the tree to give the table more room.

Export CSV writes the rows that match the filters of the Data section to a CSV file, in its order and with its visible columns. The file is UTF-8 with a byte order mark, so Excel opens it with the right encoding, dates and numbers are in the invariant format, and a text that a spreadsheet could take as a formula gets an apostrophe before it.

Nothing can be changed: there is no editing, no SQL to run, and the list service only reads the tables it allows.

Which Tables Are Shown

The DataExplorer section of the settings chooses the tables of each connection with regular expressions, which are matched against the table name with its schema, e.g. dbo.Orders, ignoring case:

"DataExplorer": {
  "ByConnectionKey": {
    "Default": {
      "IncludeTablesRegex": "^.*$"
    },
    "Northwind": {
      "IncludeTablesRegex": "^.*$",
      "ExcludeTablesRegex": "^.*1997.*$"
    },
    "Sales": {
      "IncludeTablesRegex": "^sales\\.",
      "ExcludeTablesRegex": "^sales\\.(Payments|CardTokens)$"
    }
  },
  "ExportRowLimit": 100000
}

The Default and Northwind connections are listed with all their tables by default, as above. A connection is only listed when it has an IncludeTablesRegex, so another connection has to be added here.

Some tables are excluded from every connection by default, as they hold internal or sensitive data:

  • Mail, DataAuditLog, DataProtectionKeys, DistributedCache, Exceptions and FileSystem,
  • the OpenId*, Role* and User* tables,
  • the acc_* (account events, sessions and invitations), aud_* (audit log), cfg_* (database settings), dash_* (dashboards), dsrc_* (data sources), exc_* (exception log), job_* (background jobs), loc_* (data translations) and mail_* (email queue) tables.

They are matched with or without a dbo. or public. schema, or in a database without schemas like SQLite, see DataExplorerConfig.DefaultExcludeTablesRegex. The tables that the modules declare as sensitive, e.g. the acc_*, aud_* and mail_* ones, come from the sensitive table registry, so a module of the application can add its own with [SensitiveTable] or [assembly: SensitiveTables(...)]. A database whose schema is the name of the user or the database, like Oracle or MySQL, needs an ExcludeTablesRegex with that schema in it. ExcludeTablesRegex adds to the default, and "UseDefaultExcludeTables": false turns the default off for a connection, e.g. to look at the email queue tables.

Only the tables that a connection allows are named anywhere on the page: a foreign key that refers to an excluded table, or that an excluded table has, is left out of the relationships, and its column shows its values without a link. That is why the columns and the relationships need no other permission than the one of the page.

Setting Default
ByConnectionKey:<key>:IncludeTablesRegex ^.*$ for Default and Northwind The tables of a connection that are shown; a connection without one is not listed.
ByConnectionKey:<key>:ExcludeTablesRegex ^.*1997.*$ for Northwind More tables to hide, besides the default ones.
ByConnectionKey:<key>:UseDefaultExcludeTables true Whether the default excluded tables are hidden.
ExportRowLimit 100000 The most rows an export writes; zero or less for no limit.
RelationshipCacheSeconds 300 How long the foreign keys of all the tables of a connection, for Referenced by, are cached; zero or less to read them each time.

What It Does Not Do

  • It runs no SQL of its own. For queries, see the SQL datasets of Dashboards, which check the tables and columns a query uses.
  • It shows no indexes or view definitions, and no row counts in the tree, as counting the rows of every table is slow on a large database.
  • The columns and the relationships come from the schema providers of Serenity, for SQL Server, PostgreSQL, MySQL, SQLite, Oracle and Firebird; a foreign key with more than one column is listed, but its values are not links.

Using Its Parts

The page is DataExplorerPanel of @serenity-is/pro.dataexplorer. DataExplorerTableGrid is the grid of the rows of one table, which can be used on its own with the connection key, the table name and the columns that the RetrieveTable service returns. DataExplorerGrid, DataTableEditor and DataConnectionEditor, the grid and the pickers of the page before, are deprecated.