<commit_before>SQL API
=======

Request format
--------------

Supported query string parameters:

  'q':        Specifies the SQL query to run
              Example:
              'http://entrypoint?q=SELECT count(*) FROM mytable'

  'format':   Specifies which format to use for the response.
              Supported formats: JSON (the default), GeoJSON,
              TopoJSON, CSV, SVG, SHP

  'filename': Sets the filename to use for the query result 
              file attachment

  'skipfields':
              Comma separate list of fields that are not wanted
              in output. Only useful with "SELECT *" queries.

  'dp':       Number of digits after the decimal point.
              Only affects format GeoJSON, TopoJSON, SVG.
              By default this is 6.

  'api_key':  Needed to authenticate in order to modify the database.

  'cache_policy':
              Set to "persist" to have the server send an Cache-Control
              header requesting caching devices to keep the response
              cached as much as possible. This is best used with a
              timestamp value in cache_buster for manual control of
              updates.

Response formats
----------------

The standard response from the CartoDB SQL API is JSON. If you are
building a web-application, the lightweight JSON format allows you to
quickly integrate data from the SQL API.

The JSON response is as follows:
```
    {
        time: 0.006,
        total_rows: 1,
        rows: [
            {
                year: "  2011",
                the_geom: "0101000020E610...",
                cartodb_id: 1,
                created_at: "2012-02-06T22:50:35.778Z",
                updated_at: "2012-02-12T21:34:08.193Z"
            }
        ]
    }
```

Alternatively, you can use the GeoJSON specification for returning data
from the API. To do so, simply supply the format parameter as GeoJSON.

The GeoJSON response is follows:
```
    {<commit_msg>Document new JSON format (addition of "fields" member)<commit_after>SQL API
=======

Request format
--------------

Supported query string parameters:

  'q':        Specifies the SQL query to run
              Example:
              'http://entrypoint?q=SELECT count(*) FROM mytable'

  'format':   Specifies which format to use for the response.
              Supported formats: JSON (the default), GeoJSON,
              TopoJSON, CSV, SVG, SHP

  'filename': Sets the filename to use for the query result 
              file attachment

  'skipfields':
              Comma separate list of fields that are not wanted
              in output. Only useful with "SELECT *" queries.

  'dp':       Number of digits after the decimal point.
              Only affects format GeoJSON, TopoJSON, SVG.
              By default this is 6.

  'api_key':  Needed to authenticate in order to modify the database.

  'cache_policy':
              Set to "persist" to have the server send an Cache-Control
              header requesting caching devices to keep the response
              cached as much as possible. This is best used with a
              timestamp value in cache_buster for manual control of
              updates.

Response formats
----------------

The standard response from the CartoDB SQL API is JSON. If you are
building a web-application, the lightweight JSON format allows you to
quickly integrate data from the SQL API.

The JSON response is as follows:
```
    {
        time: 0.006,
        total_rows: 1,
        fields: {
                'year': { type:'string' },
                'the_geom': { type:'geometry' },
                'cartodb_id': { type:'number' },
                'created_at': { type:'date' },
                'updated_at': { type:'date' }
        },
        rows: [
            {
                year: "  2011",
                the_geom: "0101000020E610...",
                cartodb_id: 1,
                created_at: "2012-02-06T22:50:35.778Z",
                updated_at: "2012-02-12T21:34:08.193Z"
            }
        ]
    }
```

Alternatively, you can use the GeoJSON specification for returning data
from the API. To do so, simply supply the format parameter as GeoJSON.

The GeoJSON response is follows:
```
    {
{'fraction_non_alphanumeric': 0.08823529411764706, 'fraction_numerical': 0.027514231499051234, 'mean_word_length': 1.8435603506405933, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5229870', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1069, 'n_words': 452}