-
Notifications
You must be signed in to change notification settings - Fork 20
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
don't infer schema on tmp tables #83
Comments
It's funny because the initial reason for staging was precisely because incoming data didn't match the final destination table schema. The tmp tables were "dump the raw incoming data here" targets, with transformations applied at the database level to convert to expected types. Consider all the timestamp fields for example: the incoming type Maybe another option here is to ditch staging entirely, and enforce the schema via pandas/Dataframe semantics vs. the |
The specific problem we were seeing is with the Perhaps a way to satisfy both constraints here is to force all the columns of the temp table to be a |
With regards to Pandas -- it's type system is somewhat less expressive than PostgreSQL, though it has recently gained the ability to extend the type system via extension arrays. I don't think that is likely worth our time, though. An aside, extension arrays have just landed in GeoPandas, which is very exciting! |
@ian-r-rose null |
The fix from #29 evolved but is still relevant, see https://github.com/CityofSantaMonica/mds-provider/blob/master/mds/db/db.py#L234 and specifically for this discussion https://github.com/CityofSantaMonica/mds-provider/blob/master/mds/db/db.py#L255 |
Is there a reason that you have cast it to |
@ian-r-rose I think that is probably a left-over from MDS 0.2.x days when this was an array field. Would a cast to |
if using
stage_first
, tmp table schema is inferred from the dataframe.Rather, the tmp table schema should be copied from the table in which you are going to upsert from.
The text was updated successfully, but these errors were encountered: