Tables

对于支持本机查询语法(SQL 或 NOSQL)的数据源,可以通过修改查询来选择数据返回格式、返回的列以及返回的顺序。For data sources that support a native query syntax (SQL or NOSQL), you can choose your data return format, which columns to return, and in what order by modifying your query. 但 CSV 文件或 Google Sheets 等源不支持查询语法。But sources like CSV files or Google Sheets don’t support a query syntax. 通过 SQL Analytics,你可以手动对表可视化效果中的数据进行重新排序、隐藏和格式设置。So SQL Analytics allows you to manually reorder, hide, and format data in your table visualizations.

可视化效果设置Visualization settings

若要开始使用,请单击表视图下的“编辑可视化效果”按钮。To get started, click the Edit Visualization button under the table view. 此时将显示设置面板,如下所示:A settings panel appears that looks like:

“可视化效果”选项Visualization options

可以执行以下操作:You can:

  • 通过使用用黄色突出显示的句柄向上或向下拖动列来重新排序Reorder Columns by dragging them up or down using the handle highlighted yellow
  • 通过切换用绿色突出显示的 可见性图标 图标来隐藏列Hide Columns by toggling the Visibility Icon icon highlighted green
  • 使用用红色突出显示的格式设置来设置列格式Format Columns using the format settings highlighted red

设置列格式Format columns

SQL Analytics 支持大多数数据库通用的数据类型:文本、数字、日期和布尔值。SQL Analytics is sensitive to the data types that are common to most databases: text, numbers, dates, and Booleans. 它还对非标准列类型(如 JSON 文档、图像和链接)提供特殊支持。But it also has special support for non-standard column types like JSON documents, images, and links.

备注

SQL Analytics 清理查询结果中的 HTML。SQL Analytics sanitizes HTML in query results. 但是,任何保留的 HTML 标记默认不会进行转义。But if any HTML tags remain they are not escaped by default. 因此,如果查询结果包含含有 HTML 的字符串字段(例如来自 Web 抓取程序),则可能会出现奇怪的效果。Thus you may see odd effects if a query result includes string fields that include HTML (for example, from a web scraper). 切换可视化编辑器中的“允许 HTML 内容”设置可转义 HTML 字符。Toggle the Allow HTML content setting in the visualization editor to escape HTML characters.

常见数据类型Common data types

如果基础数据源未提供类型信息,则 SQL Analytics 会将列呈现为文本。SQL Analytics renders a column as text if your underlying data source does not provide type information. 可使用表可视化编辑器强制它使用任意类型。You can force it to use arbitrary types using the table visualization editor. 这对于不支持类型数据的源(如 SQLite、Google Sheets 或 CSV 文件)特别有用。This is especially useful for sources like SQLite, Google Sheets, or CSV files where type data is not available. 例如,可以:You can, for example:

  • 显示所有浮点数的小数点后三位Display all floats out to three decimal places
  • 仅显示日期列的月份和年份Show only the month and year of a date column
  • 零填充所有整数Zero-pad all integers
  • 在数字字段中前面追加或后面追加文本Prepend or append text to your number fields

有关对数字和日期和时间数据类型进行格式设置的参考信息,请参阅:For reference information on formatting numeric and date and time data types, see:

特殊数据类型Special data types

SQL Analytics 还支持通用数据库规范之外的数据类型。SQL Analytics also supports data types outside the common database specifications.

  • JSON 文档:如果基础数据在字段中返回 JSON 格式的文本,则可以指示 SQL Analytics 这样显示它。JSON document: If your underlying data returns JSON formatted text in a field, you can instruct SQL Analytics to display it as such. 这种显示方式可以以清晰的格式折叠和展开元素。This lets you collapse and expand elements in a clean format.

  • 映像:如果数据库中的某个字段包含指向某个图像的链接,则 SQL Analytics 可将该图像与表结果进行内联并显示出来。Image: If a field in your database contains links to an image, SQL Analytics can display that image inline with your table results. 这对于仪表板特别有用。This is especially useful for dashboards.

    包含图像的仪表板

    在前面的仪表板中,“客户图像”字段是指向 SQL Analytics 就地显示的图片的 URL。In the preceding dashboard, the Customer Image field is a URL to a picture which SQL Analytics displays in-place.

  • HTML 链接:与图像一样,可以将仪表板中的 HTML 链接设置为可单击的链接。HTML link: Just like with images, HTML links from your dashboard can be made clickable. 只需使用列格式选择器中的“链接”选项。Just use the Link option in the column format selector.