You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.
While reviewing PR #129, @pushyamig added the following comment:
Looking into the sqlalchemy library, the execute function will raise an exception ( in the unknown situation). This should be wrapped in try-catch. Similarly, in the other parts of code that are doing a DB transaction. This issue need not be solved here but can be taken as a separate issue
While I will admit some ignorance on this topic and can certainly be persuaded to change my views, I don't really feel like wrapping our current code using database transactions -- conn.execute or df.to_sql -- with try/except alone is going to do very much. Without the try/except, the code will fail if a transaction fails, leaving the database in an inconsistent state (if other transactions were already executed and committed). With the try/except, the only difference I can imagine would be that we're raising the error ourselves and exiting explicitly.
That said, we can definitely do more to monitor transactions and rollback proposed changes if they would cause an error. This would keep the database from entering an inconsistent or partially populated state. I don't think (but don't know for sure) this can be done with pandas.
I think one way we might handle this is to use the SQLAlchemy ORM with a try/except. Something like what is shown in the first example here. I already have a rough implementation of the ORM, so this might not be that much work.
The text was updated successfully, but these errors were encountered:
While reviewing PR #129, @pushyamig added the following comment:
Looking into the
sqlalchemy
library, theexecute
function will raise an exception ( in the unknown situation). This should be wrapped in try-catch. Similarly, in the other parts of code that are doing a DB transaction. This issue need not be solved here but can be taken as a separate issueOriginally posted by @pushyamig in #129
While I will admit some ignorance on this topic and can certainly be persuaded to change my views, I don't really feel like wrapping our current code using database transactions --
conn.execute
ordf.to_sql
-- withtry/except
alone is going to do very much. Without thetry/except
, the code will fail if a transaction fails, leaving the database in an inconsistent state (if other transactions were already executed and committed). With thetry/except
, the only difference I can imagine would be that we're raising the error ourselves and exiting explicitly.That said, we can definitely do more to monitor transactions and rollback proposed changes if they would cause an error. This would keep the database from entering an inconsistent or partially populated state. I don't think (but don't know for sure) this can be done with
pandas
.I think one way we might handle this is to use the SQLAlchemy ORM with a
try/except
. Something like what is shown in the first example here. I already have a rough implementation of the ORM, so this might not be that much work.The text was updated successfully, but these errors were encountered: