-
Notifications
You must be signed in to change notification settings - Fork 0
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
Figure out how to deal with type mismatch #40
Comments
Possible Strategy: Require Data Formatting Before Table UploadThoughts about formatting before table upload
Example (brainstorming)
class JoinTargetFormatType(models.Model)
name = models.CharField(max_length=255, help_text='Census Tract (6 digits, no decimal)')
description_shorthand = models.CharField(max_length=255, help_text='dddddd')
clean_steps = models.TextField(help_text='verbal description. e.g. Remove non integers. Check for empty string. Pad with zeros until 6 digits.')
# ??regex_replacement_string - could get ugly
regex_replacement_string = models.CharField(help_text='"[^0-9]"; Usage: re.sub("[^0-9]", "", "1234.99"'\
, max_length=255)
# ??python_code_snippet - dangerous - not to run directly
#
# val_list = [re.sub("[^0-9]", "", `x`) for x in val_list]
# val_list = [x for x in val_list if len(x) > 0]
# val_list = [x.zfill(6) for x in val_list if len(x) > 0]
#
python_code_snippet = models.TextField(blank=True)
# ??tranformation_function_name - do cleaning on GeoNode side with a set of predefined transformation functions
#
# Viable - e.g. Use top geospatial identifiers and formats
#
tranformation_function_name = models.CharField(max_length=255, blank=True, choices=TRANSFORMATION_FUNCTIONS) |
This should work just fine. Not sure what you would do with the regex on the other side, but it should work. Lets discuss. |
Ok, I've implemented the basic model for this (without actually hooking anything up so that it does something). The jointarget endpoint now returns this.
|
This endpoint is now returning a meaningful error now as well on type mismatch. Error Creating Join: Error Joining table boston_income_73g_5fihmpx to layer geonode:tl_2014_25_tract: operator does not exist: character varying = integer\nLINE 1: ..._income_73g_5fihmpx on tl_2014_25_tract."TRACTCE" = boston_i...\n ^\nHINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.\n |
Note that for testing purposes, Im doing this manually on the server side by doing an explicit type cast from integer to string and then left padding with 0s. |
Closing as dupe of #49 |
In this example, the tract field is an int in the table and a varchar in the layer.
https://dpaste.de/CbXC
https://dpaste.de/zy5Q#L9,35
The text was updated successfully, but these errors were encountered: