Repository navigation
fix #284: mising param handling for versioned_table statement(s) in positional_args_to_dict L485 in manager.py - #283
Conversation
… versioned_table in positional_args_to_dict
…tional_args_to_dict
|
I'm not convinced by these fixes. I think the function needs rewriting really, as INSERT can take many forms under SQLA these days. |
| elif op == Operation.INSERT: | ||
| columns = table.columns.values() | ||
| for index, column in enumerate(columns): | ||
| if column.type.__class__.__name__.lower() in ('datetime', ...): # todo add any other type of datetime column? |
There was a problem hiding this comment.
When checking for class - prefer using isinstance(column.type, CLASSNAME)
In this case - isinstance(column.type, sa.DateTime)
But even if you do that - there is no reliable way to get the "type" here. Some DBs use TIMESTAMP, some use DATETIME, TIMETZ, DATE, etc.
There was a problem hiding this comment.
thanks for the feedback tried to address this in #295
| if column.type.__class__.__name__.lower() in ('datetime', ...): # todo add any other type of datetime column? | ||
| # from dateutil.parser import parse # dateutil not part of requirement in setup.py so commenting | ||
| # parameters[column.name] = parse(params[index]) | ||
| parameters[column.name] = datetime.fromisoformat(params[index]) # '2022-08-18 04:45:36.942711' params contains ISO Formated date |
There was a problem hiding this comment.
We are assuming the params is an ISO formatted date here - but that is only in sqlite
So, this may be breaking in mysql, postgres, etc.
There was a problem hiding this comment.
thanks for the feedback tried to address this in #295
|
separated the PR for #282 in #295
Was trying to make an attempt to write a new version for this method but have couple of doubts, so far i made WIP changes which look like this I had a couple doubts
and is it ok to always pull primary_key lookup to delete a association entry as a deletion can also happen based on create date or any other non-primary column e.g "Delete all assoc entries prior to 2020 or delete all assoc entries where event was = ABC"
|
|
Closing this as #295 addresses this issue |
Hi,
Raising PR to address #282 , could you please review it and let know of feedback on comments in code or any other changes needed
Before Change pytest run summary
After Change pytest run summary
Thanks