Closed yoimnik closed 5 years ago
i changed the type of that column from propulsion_types[]
to text[]
, moved past that error, but now i ran into another casting issue:
psycopg2.ProgrammingError: column "event_time" is of type timestamp with time zone but expression is of type numeric
LINE 1: ....015159746663656]}}', 'user_pick_up', 'reserved', 1547268299...
did we change something with how we interface with the mds-provider-services db via sqlalchemy or was there a version change on sqlalchemy's end?
nvm i think i found the issue --
we were running this with --stage_first 0
... which causes the code block https://github.com/CityofSantaMonica/mds-provider/blob/master/mds/db/load.py#L143
if we don't specify --stage_first then the code doesn't work and gives us this error:
Traceback (most recent call last):
File "main.py", line 362, in <module>
ingest(mds.STATUS_CHANGES, client=client, **kwargs)
File "main.py", line 285, in ingest
load_data(datasource, record_type, **kwargs)
File "/home/jovyan/work/mds/load.py", line 60, in load_data
stage_first = int(kwargs.get("stage_first", False))
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
we need to correctly handle default stage_first
The issue here was with a bad stage_first
default as noted in CityofSantaMonica/mds-provider-services#37.
The code in mds-provider
is behaving as expected (without staging first, data is dumped directly to the target table and assumes the target table can handle it).
I'm closing this and we'll get the fix in the linked PR merged ASAP.
i get the error copy/pasted below when i try to run an ingest on mds-provider-services
i see that in mds-provider-services, the status_changes table is created and there's a column created like this:
propulsion_type propulsion_types[] NOT NULL,
propulsion_types
is an enum that's also created, that looks like this:now it seems like there's no handling for this on the sql alchemy side. it looks like it cannot automatically cast a
text[]
type intopropulsion_types[]
i don't know how to fix this, i've tried pandas categorical types but that didn't work either. does pandas just not handle enum arrays in sql?