Skip to content

Conversation

@melange396
Copy link
Collaborator

addresses #941

a question remains about how to handle the new exception in csv_to_database.py:upload_archive -- i would argue the behavior i have here is correct: it stops processing any more files and leaves them where they are. the exception condition would arise because of a problem with the database (and not with the files) so it should not handle unprocessed files with archive_as_failed. if this breaks some filesystem maintenance paradigm though, im fine with changing it.

Copy link
Contributor

@krivard krivard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming the SQL in test_db is begrudging, 🚀

Comment on lines +39 to +43
self._db._cursor.execute(f'''
INSERT INTO {self._db.load_table}
(source, `signal`, geo_type, geo_value, time_type, time_value, issue, `lag`, value_updated_timestamp)
VALUES
('sr', 'si', 'gt', 'gv', 'tt', 3, 8, 5, 13)''')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm i kinda wanna find a way to refactor this out just so we don't have to continually mess with it when we make more changes. did you already look at that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

twas indeed quite begrudging. ive thought about a better way to handle it, but i cant really come up with something that bothers me less. i also had to do something similar with the AI counter fix method here

"""Test that the row count is returned"""
mock_connector = MagicMock()
database = Database()
database.count_all_load_rows = lambda:0 # simulate an empty load table
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch + good fix

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was neat!

@melange396 melange396 merged commit a6d53f4 into v4-schema-revisions-release-prep Sep 1, 2022
@melange396 melange396 deleted the db_load_state_exception branch September 1, 2022 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants