Revert "Revert "Merge pull request #12753 from CartoDB/12566-georeferencer-connectors""

This reverts commit 2c7205f7f3.
pull/12765/head
Alberto Romeu 7 years ago
parent c36c95a00f
commit 7e62b0bb09

1
.gitignore vendored

@ -73,3 +73,4 @@ doc/manual/build
.vscode/
/private_gears
/dist
yarn.lock

2
.gitmodules vendored

@ -1,6 +1,6 @@
[submodule "lib/assets/javascripts/cdb"]
path = lib/assets/javascripts/cdb
url = git://github.com/CartoDB/cartodb.js.git
url = git://github.com/CartoDB/cartodb.js.git
[submodule "app/assets/stylesheets/old_common"]
path = app/assets/stylesheets/old_common
url = git://github.com/CartoDB/cartodb.css.git

@ -2,6 +2,7 @@ Development
-----------
### Features
* Enable georeferencer for database connectors (#12566)
* Enable other hosts apart from account host to include CORS headers via the cors_enabled_hosts param in app_config.yml (#12685)
* Add tooltips to show bucket data in time-series (#11650)
* Improve legend items management (#12650)

@ -2,6 +2,7 @@
require 'carto/connector'
require_relative 'exceptions'
require_relative 'georeferencer'
require_relative 'runner_helper'
module CartoDB
@ -28,6 +29,7 @@ module CartoDB
@job = options[:job] || new_job(@log, @pg_options)
@user = options[:user]
@collision_strategy = options[:collision_strategy]
@georeferencer = options[:georeferencer] || new_georeferencer(@job)
@id = @job.id
@unique_suffix = @id.delete('-')
@ -49,6 +51,8 @@ module CartoDB
if should_import?(@connector.remote_table_name)
@job.log "Copy connected table"
warnings = @connector.copy_table(schema_name: @job.schema, table_name: @job.table_name)
@job.log 'Georeference geometry column'
georeference
@warnings.merge! warnings if warnings.present?
else
@job.log "Table #{table_name} won't be imported"
@ -64,6 +68,12 @@ module CartoDB
end
end
def georeference
@georeferencer.run
rescue => error
@job.log "ConnectorRunner Error while georeference #{error}"
end
def remote_data_updated?
@connector.remote_data_updated?
end
@ -134,6 +144,10 @@ module CartoDB
Job.new(logger: log, pg_options: pg_options)
end
def new_georeferencer(job)
Georeferencer.new(job.db, job.table_name, {}, Georeferencer::DEFAULT_SCHEMA, job)
end
UNKNOWN_ERROR_CODE = 99999
def error_for(exception)

Loading…
Cancel
Save