Skip to content

[RDBMS] MySQL/Postgres command support#3236

Merged
tjprescott merged 3 commits intoAzure:masterfrom
Suna-MS:master
May 8, 2017
Merged

[RDBMS] MySQL/Postgres command support#3236
tjprescott merged 3 commits intoAzure:masterfrom
Suna-MS:master

Conversation

@Suna-MS
Copy link
Copy Markdown
Contributor

@Suna-MS Suna-MS commented May 8, 2017


This checklist is used to make sure that common guidelines for a pull request are followed.

General Guidelines

  • The PR has modified HISTORY.rst with an appropriate description of the change (see Modifying change log).

Command Guidelines

(see Authoring Command Modules)

@msftclas
Copy link
Copy Markdown

msftclas commented May 8, 2017

@Suna-MS,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot


import azure.cli.command_modules.rdbms.help # pylint: disable=unused-import

__all__ = ['load_params', 'load_commands']
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove the commented codes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

@troydai troydai May 8, 2017

Choose a reason for hiding this comment

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

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)])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same, please remove.


# self.cmd('{} db delete -g {} -s {} -n {} --yes'
# .format(engine, rg, server, database_name),
# checks=[NoneCheck()])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same, please remove.

checks=[NoneCheck()])

import os
os.remove(file_name)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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")
Copy link
Copy Markdown
Contributor

@troydai troydai May 8, 2017

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok.

'azure.mgmt.rdbms.{}.operations.log_files_operations'.format(server_type),
'LogFilesOperations')

def log_file_factory(args):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the factory can be defined in the context scope for a better code organizing.

@codecov-io
Copy link
Copy Markdown

codecov-io commented May 8, 2017

Codecov Report

Merging #3236 into master will decrease coverage by 0.07%.
The diff coverage is 63.41%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
...li-rdbms/azure/cli/command_modules/rdbms/params.py 100% <100%> (ø)
...-cli-rdbms/azure/cli/command_modules/rdbms/help.py 100% <100%> (ø)
.../command_modules/azure-cli-rdbms/azure/__init__.py 100% <100%> (ø)
...-rdbms/azure/cli/command_modules/rdbms/__init__.py 100% <100%> (ø)
...mand_modules/azure-cli-rdbms/azure/cli/__init__.py 100% <100%> (ø)
...re-cli-rdbms/azure/cli/command_modules/__init__.py 100% <100%> (ø)
...li-rdbms/azure/cli/command_modules/rdbms/custom.py 11.47% <11.47%> (ø)
...dbms/azure/cli/command_modules/rdbms/validators.py 29.03% <29.03%> (ø)
...cli-rdbms/azure/cli/command_modules/rdbms/_util.py 48.93% <48.93%> (ø)
...-rdbms/azure/cli/command_modules/rdbms/commands.py 89.79% <89.79%> (ø)
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bf2a6a3...13cc3f1. Read the comment docs.

@derekbekoe derekbekoe modified the milestone: Build Milestone May 8, 2017
Copy link
Copy Markdown
Member

@tjprescott tjprescott left a comment

Choose a reason for hiding this comment

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

Please open the second PR with the test files.

@tjprescott tjprescott changed the title Initial commit for mysql and postgres command module [RDBMS] MySQL/Postgres command support May 8, 2017
logger.warn("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}

VERSION = '0.0.1'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Add +dev to this version.
The version number will be changed just before releasing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was told that should not add +dev to the version, so i removed it.

@tjprescott tjprescott merged commit c88ef10 into Azure:master May 8, 2017
@tjprescott
Copy link
Copy Markdown
Member

@derekbekoe I will add a PR to add +dev to the setup file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants