|
|
|
@ -7,6 +7,8 @@ module CartoDB
|
|
|
|
|
|
|
|
|
|
DEFAULT_BATCH_SIZE = 5000
|
|
|
|
|
DEFAULT_MAX_ROWS = 1000000
|
|
|
|
|
HTTP_CONNECT_TIMEOUT = 60
|
|
|
|
|
HTTP_DEFAULT_TIMEOUT = 600
|
|
|
|
|
|
|
|
|
|
attr_reader :connection, :working_dir, :table_name, :hits, :misses,
|
|
|
|
|
:max_rows, :sql_api, :formatter, :cache_results
|
|
|
|
@ -134,11 +136,12 @@ module CartoDB
|
|
|
|
|
|
|
|
|
|
def run_query(query, format = '')
|
|
|
|
|
params = { q: query, api_key: sql_api[:api_key], format: format }
|
|
|
|
|
http_client = Carto::Http::Client.get('geocoder_cache')
|
|
|
|
|
response = http_client.post(
|
|
|
|
|
sql_api[:base_url],
|
|
|
|
|
body: URI.encode_www_form(params)
|
|
|
|
|
)
|
|
|
|
|
http_client = Carto::Http::Client.get('geocoder_cache',
|
|
|
|
|
log_requests: true,
|
|
|
|
|
connecttimeout: HTTP_CONNECT_TIMEOUT,
|
|
|
|
|
timeout: HTTP_DEFAULT_TIMEOUT)
|
|
|
|
|
response = http_client.post(sql_api[:base_url],
|
|
|
|
|
body: URI.encode_www_form(params))
|
|
|
|
|
response.body
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|