This repository was archived by the owner on Mar 31, 2026. It is now read-only.
refactor(db_api): cleanup the code#636
Merged
gcf-merge-on-green[bot] merged 6 commits intogoogleapis:mainfrom Nov 25, 2021
Merged
refactor(db_api): cleanup the code#636gcf-merge-on-green[bot] merged 6 commits intogoogleapis:mainfrom
gcf-merge-on-green[bot] merged 6 commits intogoogleapis:mainfrom
Conversation
IlyaFaer
commented
Nov 2, 2021
| TABLE_SCHEMA = '' | ||
| AND | ||
| TABLE_NAME = @table_name | ||
| """ |
IlyaFaer
commented
Nov 2, 2021
| table = parts.get("table") | ||
| columns = parts.get("columns") | ||
| values = parts.get("values") | ||
| return transaction.insert(table, columns, values) |
IlyaFaer
commented
Nov 2, 2021
|
|
||
| return function(connection, *args, **kwargs) | ||
|
|
||
| return wrapper |
Author
There was a problem hiding this comment.
Moving the check into a decorator, as we planned long ago
IlyaFaer
commented
Nov 2, 2021
|
|
||
| def _do_execute_update(self, transaction, sql, params): | ||
| sql = parse_utils.ensure_where_clause(sql) | ||
| sql, params = parse_utils.sql_pyformat_args_to_spanner(sql, params) |
Author
There was a problem hiding this comment.
There are the same lines earlier, but under an if statement. Merging both cases into one.
IlyaFaer
commented
Nov 2, 2021
| statements.append(ddl) | ||
|
|
||
| # Only queue DDL statements if they are all correctly classified. | ||
| self.connection._ddl_statements.extend(statements) |
Author
There was a problem hiding this comment.
Separating DDLs batching into a method
IlyaFaer
commented
Nov 2, 2021
| # self._run_prior_DDL_statements() | ||
| self.connection.run_prior_DDL_statements() | ||
|
|
||
| if not self.connection.autocommit: |
Author
There was a problem hiding this comment.
Moving several commands away of this if statement to avoid duplicating them in the further methods calls
IlyaFaer
commented
Nov 2, 2021
|
|
||
|
|
||
| def parse_values(stmt): | ||
| return expect(stmt, VALUES) |
Author
There was a problem hiding this comment.
This function is used only once and is quite simple. Let's erase it
IlyaFaer
commented
Nov 2, 2021
| return "", pyfmt_str | ||
|
|
||
| # Otherwise we expect a function. | ||
| return expect(word, FUNC) |
Author
There was a problem hiding this comment.
Didn't find where EXPR is passed into the method, so I guess it's not actually used
IlyaFaer
commented
Nov 2, 2021
| :returns: A tree of the already parsed expression. | ||
| """ | ||
| _, _values = parse_values(values_stmt) | ||
| return _values |
larkee
approved these changes
Nov 23, 2021
anukaal
approved these changes
Nov 24, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.