[RDBMS] MySQL/Postgres command support#3236
[RDBMS] MySQL/Postgres command support#3236tjprescott merged 3 commits intoAzure:masterfrom Suna-MS:master
Conversation
|
@Suna-MS, |
|
|
||
| import azure.cli.command_modules.rdbms.help # pylint: disable=unused-import | ||
|
|
||
| __all__ = ['load_params', 'load_commands'] |
There was a problem hiding this comment.
The CLI itself doesn't rely on the symbols exposed in __all__ to find these two function. So to us, it is optional.
| def _test_db_mgmt(self, resource_group, server, engine): | ||
| # database_name = "cliautomationdb01" | ||
| # charset = 'utf8' | ||
| # collation = 'utf8_general_ci' if engine == 'mysql' else 'English_United States.1252' |
There was a problem hiding this comment.
Please remove the commented codes.
There was a problem hiding this comment.
Want to keep them here because it was initially required, but to keep consistent with portal, the commands was temporarily removed, in case we need to re-open these commands later.
There was a problem hiding this comment.
Then please keep the code in a staging area (git stash or commit to a separate branch). We should not archive code in the main code base.
| # checks=[ | ||
| # JMESPathCheck('resourceGroup', rg), | ||
| # JMESPathCheck('name', database_name), | ||
| # JMESPathCheck('collation', collation)]) |
|
|
||
| # self.cmd('{} db delete -g {} -s {} -n {} --yes' | ||
| # .format(engine, rg, server, database_name), | ||
| # checks=[NoneCheck()]) |
| checks=[NoneCheck()]) | ||
|
|
||
| import os | ||
| os.remove(file_name) |
There was a problem hiding this comment.
This will not guarantee the file is deleted in the case when the previous assertion failed. Please use self.addCleanup to register clean up code. https://docs.python.org/2/library/unittest.html#unittest.TestCase.addCleanup
|
|
||
|
|
||
| add_helps("mysql", "MySQL") | ||
| add_helps("postgres", "PostgreSQL") |
There was a problem hiding this comment.
I advise against using a loop in help.py file. The file is expected to be a fast access for documentation. Therefore a flat and clean format for faster accessibility to the command document trumps the need of reusability. Please flatten the loop.
There was a problem hiding this comment.
We plan to split the command module to two later, i will keep it as it now, and after split to two command module, there will be no such issue. Same as below.
| 'azure.mgmt.rdbms.{}.operations.log_files_operations'.format(server_type), | ||
| 'LogFilesOperations') | ||
|
|
||
| def log_file_factory(args): |
There was a problem hiding this comment.
the factory can be defined in the context scope for a better code organizing.
Codecov Report
@@ Coverage Diff @@
## master #3236 +/- ##
==========================================
- Coverage 70.35% 70.27% -0.08%
==========================================
Files 381 391 +10
Lines 24777 25067 +290
Branches 3785 3811 +26
==========================================
+ Hits 17431 17616 +185
- Misses 6237 6342 +105
Partials 1109 1109
Continue to review full report at Codecov.
|
tjprescott
left a comment
There was a problem hiding this comment.
Please open the second PR with the test files.
| logger.warn("Wheel is not available, disabling bdist_wheel hook") | ||
| cmdclass = {} | ||
|
|
||
| VERSION = '0.0.1' |
There was a problem hiding this comment.
Add +dev to this version.
The version number will be changed just before releasing.
There was a problem hiding this comment.
I was told that should not add +dev to the version, so i removed it.
|
@derekbekoe I will add a PR to add +dev to the setup file. |
This checklist is used to make sure that common guidelines for a pull request are followed.
General Guidelines
Command Guidelines
(see Authoring Command Modules)