2014-01-24 19:12:10 -05:00
---
layout: doc_page
---
2014-10-29 15:32:24 -04:00
## Datasources
A data source is the Druid equivalent of a database table. However, a query can also masquerade as a data source, providing subquery-like functionality. Query data sources are currently supported only by [GroupBy ](GroupByQuery.html ) queries.
2014-01-24 19:12:10 -05:00
### Table Data Source
2014-10-29 15:32:24 -04:00
The table data source is the most common type. It's represented by a string, or by the full structure:
2014-01-24 19:12:10 -05:00
```json
{
"type": "table",
2014-11-11 14:56:22 -05:00
"name": "< string_value > "
2014-01-24 19:12:10 -05:00
}
```
2014-10-29 15:32:24 -04:00
### Union Data Source
2015-03-26 13:44:11 -04:00
2014-10-31 14:07:55 -04:00
This data source unions two or more table data sources.
2014-10-29 15:32:24 -04:00
```json
{
"type": "union",
2014-11-11 14:56:22 -05:00
"dataSources": ["< string_value1 > ", "< string_value2 > ", "< string_value3 > ", ... ]
2014-10-29 15:32:24 -04:00
}
```
2014-11-11 14:56:22 -05:00
Note that the data sources being unioned should have the same schema.
2014-01-24 19:12:10 -05:00
### Query Data Source
2015-03-26 13:44:11 -04:00
This is used for nested groupBys and is only currently supported for groupBys.
2014-01-24 19:12:10 -05:00
```json
{
"type": "query",
"query": {
"type": "groupBy",
...
}
}
```