Constrain uniqueness of column name and move geocoding column creation #4151
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Any background context you want to provide?
In #4146 there were two of the exact same columns (
geocoded_county
) created during the geocoding column creation. They were created within 0.003 seconds of each other. I attempted to recreate the issue but was unable as this was probably a race condition. To fix the issue, a db admin will need to remove the redundant column manually from the database. @RDmitchell - I did this for your LBNL 405 organization if you want to continue testing.What's this PR do?
To prevent this from happening in the future 2 things were done:
celery_chain
call. Therefore, if this was a parallelization race condition, then the columns should exist when the geocoding runs theget_or_create
call.column_name
,org
,table_name
,is_extra_data
, andunits_pint
columns. Using the production database, there were no conflicts when running.I debated on adding the
units_pint
to the constraint and ended up adding it because I can see the use case where there are two mapping profiles where one set of data are coming in as m2 and another is coming in as ft2; both of which should be allowed to exist. IF we removeunits_pint
then the production database will have to resolve some naming conflicts which exist due to old orgs not having the units_pint and defaulting toNone
. @haneslinger -- I know we discussed this constraint in the past but I don't remember the context.Other items in the PR:
shapely
to2.0.1
. It was segfaulting on WKT translation with Python 3.9 on osxHow should this be manually tested?
geocoded_neighborhood
)geocode_by_ids
and add in a property id and org.What are the relevant tickets?
#4146
Screenshots (if appropriate)