Skip to content

Commit

Permalink
Merge pull request #2000 from szarnyasg/iss1857
Browse files Browse the repository at this point in the history
Improve JSON documentation, add maximum_sample_files option
  • Loading branch information
szarnyasg committed Jan 31, 2024
2 parents 18f691c + 96316a0 commit cd78f4a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/extensions/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ These functions have the following parameters:

| Name | Description | Type | Default |
|:--|:-----|:-|:-|
| `maximum_object_size` | The maximum size of a JSON object (in bytes) | `UINTEGER` | `16777216` |
| `format` | Can be one of `['auto', 'unstructured', 'newline_delimited', 'array']` | `VARCHAR` | `'array'` |
| `ignore_errors` | Whether to ignore parse errors (only possible when `format` is `'newline_delimited'`) | `BOOL` | `false` |
| `compression` | The compression type for the file. By default this will be detected automatically from the file extension (e.g., `t.json.gz` will use gzip, `t.json` will use none). Options are `'none'`, `'gzip'`, `'zstd'`, and `'auto'`. | `VARCHAR` | `'auto'` |
| `filename` | Whether or not an extra `filename` column should be included in the result. | `BOOL` | `false` |
| `format` | Can be one of `['auto', 'unstructured', 'newline_delimited', 'array']`. | `VARCHAR` | `'array'` |
| `hive_partitioning` | Whether or not to interpret the path as a [hive partitioned path](../data/partitioning/hive_partitioning). | `BOOL` | `false` |
| `ignore_errors` | Whether to ignore parse errors (only possible when `format` is `'newline_delimited'`). | `BOOL` | `false` |
| `maximum_sample_files` | The maximum number of JSON files sampled for auto-detection. | `BIGINT` | `32` |
| `maximum_object_size` | The maximum size of a JSON object (in bytes). | `UINTEGER` | `16777216` |

The `format` parameter specifies how to read the JSON from a file.
With `'unstructured'`, the top-level JSON is read, e.g.:
Expand Down Expand Up @@ -138,8 +139,8 @@ DuckDB also supports reading JSON as a table, using the following functions:

| Function | Description |
|:----|:-------|
| `read_json(`*`filename`*`)` | Read JSON from `filename`, where `filename` can also be a list of files, or a glob pattern |
| `read_json_auto(`*`filename`*`)` | Alias for `read_json` with all auto-detection enabled |
| `read_json(`*`filename`*`)` | Read JSON from `filename`, where `filename` can also be a list of files, or a glob pattern |
| `read_json_auto(`*`filename`*`)` | Alias for `read_json` with all auto-detection enabled |
| `read_ndjson(`*`filename`*`)` | Alias for `read_json` with parameter `format` set to `'newline_delimited'` |
| `read_ndjson_auto(`*`filename`*`)` | Alias for `read_json_auto` with parameter `format` set to `'newline_delimited'` |

Expand Down

0 comments on commit cd78f4a

Please sign in to comment.