vectorQuerySource
You can use vectorQuerySource to build layers and widgets using custom SQL queries powered by your data warehouse that contain:
Vector data:
points,
lines,
polygons
etc...
Usage
Options
sqlQuery: The custom SQL query that you want to use to retrieve data from your data warehouse. You should use valid syntax for your data warehouse, which allows you to use all kinds of advanced processing directly in the data source. For example, for a BigQuery connection,
SELECT * FROM carto-demo-data.demo_tables.chicago_crime_sample LIMIT 100
would be a valid SQL query.spatialDataColumn (optional): The name of the column that contains the geospatial information (geometries/geographies) that will be used for visualization and etc. By default, CARTO assumes this column is named
geom
.aggregationExp (optional): An optional SQL expression that will define how this source will group identical geometries found in the
spatialDataColumn
. By default this property is empty and all rows will be returned. However, when this property is defined:This source will return only one data point for each set of duplicated geometries
Each set of duplicated geometries will be aggregated using the aggregation expression defined. For example, if you have a dataset with multiple identical polygons or points and a "income" column and your
aggregationExp
isAVG(income)
, only one polygon or point will be returned, with an income column that equals the average income of all the polygons or points identical to that one.
columns (optional): The list of columns to retrieve from the query specified in
sqlQuery
. Useful to increase performance and optimize query costs in queries with a large number of columns, without having to manage all possible variants ofsqlQuery
. By default, all columns will be retrieved.filters (optional): A valid CARTO Filters object, used to perform server-side filtering of this data source with column-based filters.
filtersLogicalOperator (optional): Indicates whether
filters
are applied following anAND
logic or anOR
logic.queryParameters (optional): If your
sqlQuery
contains query parameters, pass the values for each parameter in this field, following your data warehouse mechanism for query parameters, like named or positional parameters.
Response
The response of vectorQuerySource
is a promise that can be resolved and used in layers and widgets.
Connection compatibility
Layer compatibility
vectorTableSource
is compatible with the following layers from the @deck.gl/carto
module:
Widget model compatibility
vectorTableSource
is compatible with the following widget models:
Last updated
Was this helpful?