GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — Removal of unnecessary API calls + cleanup by mf2199 · Pull Request #20 · MaxxleLLC/python-spanner-django Conversation
|
|
|
||
| database = instance.database(database_id, pool=spanner.pool.BurstyPool()) | ||
| if not database.exists(): | ||
| raise ValueError("database '%s' does not exist." % database_id) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Can't say I like it. If we'll not check the existence here, a lot of objects (instance, database, session, transaction - with all of their state attributes) will be initialized before something will fail, so we'll still be using resources. And it'll fail with Google-specific error google.api_core.exceptions.NotFound. PEP 249 lists its own exceptions (and the Python default exceptions), which must be raised instead of those project-specific, so this NotFound error gonna be confusing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@IlyaFaer I recall having similar idea when working on Managed Backups, and the code owners' feedback was in favor of not making "optional" admin API calls unless required by the specification (this may have something to do with the billing and price reduction). I see nothing in PEP-249 that requires those checks, and the expected normal setup implies having both the instance and the database to exist a priori. Therefore the responsibility can be delegated to the user who is free to choose whether to run the checks or not - at their own expense.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.