Last active
July 18, 2018 06:11
-
-
Save greatwhole/512a3ae530e429558b6ec505b9636ff9 to your computer and use it in GitHub Desktop.
convert connection string to cmd
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
from sqlalchemy.engine.url import make_url | |
def convert_to_cmd(connection_string): | |
url = make_url(connection_string) | |
pattern = 'mysql -u {username} -h {host} -P {port} -D {database} -p{password}' | |
cmd = pattern.format(username=url.username, host=url.host, port=url.port, database=url.database, password=url.password) | |
return cmd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment