Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronization overwrite mode for geocoding only #14991

Merged
merged 14 commits into from
Jul 2, 2019
Merged

Conversation

jgoizueta
Copy link
Contributor

@jgoizueta jgoizueta commented Jun 25, 2019

This includes minimal modifications to choose between overwriting by replacement or synchronization.

The the new sync mode is used only for tables that have a carto_geocode_hashcolumn, i.e. tables processed by the geocoder analysis. This is so to be able to put this in production in the safest way: regular syncs, in particular all existing syncs shouldn't be affected.

This would benefit from cleaning up Table/TableSetup/Adapter redundancies, specially import_cleanup, but we'll keep that separate.

Note that this build upon the work in #14937

Rafa de la Torre and others added 9 commits June 3, 2019 13:04
@jgoizueta jgoizueta requested a review from rafatower June 25, 2019 14:38
app/models/synchronization/adapter.rb Outdated Show resolved Hide resolved
app/models/synchronization/adapter.rb Outdated Show resolved Hide resolved
app/models/synchronization/adapter.rb Show resolved Hide resolved
app/models/synchronization/adapter.rb Outdated Show resolved Hide resolved
app/models/synchronization/adapter.rb Show resolved Hide resolved
@jgoizueta
Copy link
Contributor Author

There is a slight difference between the previous overwrite by replacement and the new one:
Now the user (non-spatial, non-PK) indices of the replaced table are created in the new table before the setup_table process, whereas they used to be created after it.

The setup_table does some metadata update (which I don't know if it's really necessary and may adapt the type of the geometry).

Copy link
Contributor

@rafatower rafatower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

spec/requests/user_state_spec.rb Outdated Show resolved Hide resolved
spec/requests/user_state_spec.rb Outdated Show resolved Hide resolved
spec/requests/user_state_spec.rb Outdated Show resolved Hide resolved
lib/carto/assets/assets_service.rb Outdated Show resolved Hide resolved
app/models/user/user_decorator.rb Outdated Show resolved Hide resolved
app/models/user/user_decorator.rb Outdated Show resolved Hide resolved
app/controllers/application_controller.rb Outdated Show resolved Hide resolved
@jgoizueta jgoizueta changed the base branch from sync-api-table-sync-poc to master June 26, 2019 08:21
@jgoizueta
Copy link
Contributor Author

Notice: before merging this, a new release of the extension is needed. Don't forget to update the lib/sql submodule and the version references in the code before merging.

This is for testing purposes (with the branch in the lib/sql submodule)
spec/models/table_spec.rb Show resolved Hide resolved
spec/models/table_spec.rb Show resolved Hide resolved
sanitize(column_names)
end


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line detected.

lib/importer/lib/cartodb-migrator/migrator.rb Show resolved Hide resolved

sanitize(column_names)
# Already done by Table#sanitize_columns in app/models/table.rb
#sanitize_columns!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after #.

app/models/table.rb Show resolved Hide resolved
@@ -187,6 +267,10 @@ def import_cleanup(schema_name, table_name)
qualified_table_name = "\"#{schema_name}\".#{table_name}"

user.db_service.in_database_direct_connection(statement_timeout: STATEMENT_TIMEOUT) do |user_database|

# For consistency with regular imports, also eases testing
Table.sanitize_columns(table_name, {database_schema: schema_name, connection: user_database})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space inside { missing.
Redundant curly braces around a hash parameter.
Space inside } missing.

app/models/synchronization/adapter.rb Show resolved Hide resolved
# Conflicts:
#	app/controllers/home_controller.rb
#	app/models/user/db_service.rb
#	lib/sql
@jgoizueta jgoizueta merged commit 5a2bc64 into master Jul 2, 2019
@jgoizueta jgoizueta deleted the sync-api-table-sync branch July 2, 2019 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants