{"action":"created","issue":{"url":"https://api.github.com/repos/PyMySQL/PyMySQL/issues/688","repository_url":"https://api.github.com/repos/PyMySQL/PyMySQL","labels_url":"https://api.github.com/repos/PyMySQL/PyMySQL/issues/688/labels{/name}","comments_url":"https://api.github.com/repos/PyMySQL/PyMySQL/issues/688/comments","events_url":"https://api.github.com/repos/PyMySQL/PyMySQL/issues/688/events","html_url":"https://github.com/PyMySQL/PyMySQL/issues/688","id":334014200,"node_id":"MDU6SXNzdWUzMzQwMTQyMDA=","number":688,"title":"Invalid warning triggered when executing \"create database IF NOT EXISTS mydatabase\"","user":{"login":"bagage","id":1451988,"node_id":"MDQ6VXNlcjE0NTE5ODg=","avatar_url":"https://avatars3.githubusercontent.com/u/1451988?v=4","gravatar_id":"","url":"https://api.github.com/users/bagage","html_url":"https://github.com/bagage","followers_url":"https://api.github.com/users/bagage/followers","following_url":"https://api.github.com/users/bagage/following{/other_user}","gists_url":"https://api.github.com/users/bagage/gists{/gist_id}","starred_url":"https://api.github.com/users/bagage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagage/subscriptions","organizations_url":"https://api.github.com/users/bagage/orgs","repos_url":"https://api.github.com/users/bagage/repos","events_url":"https://api.github.com/users/bagage/events{/privacy}","received_events_url":"https://api.github.com/users/bagage/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-06-20T10:20:23Z","updated_at":"2018-06-21T08:05:42Z","closed_at":"2018-06-20T10:37:13Z","author_association":"NONE","body":"When running the following code:\r\n\r\n```python3\r\n#!/usr/bin/env python3\r\n\r\nimport pymysql\r\n\r\ndb = pymysql.connect(\"localhost\", \"root\", \"root\")\r\ncursor = db.cursor()\r\ncursor.execute(\"create database IF NOT EXISTS mydatabase\")\r\ncursor.execute(\"create database IF NOT EXISTS mydatabase\") # invalid warning triggered here\r\n```\r\n\r\nI get a warning in the console output:\r\n\r\n```\r\n/home/user/.local/lib/python3.6/site-packages/pymysql/cursors.py:170: Warning: (1007, \"Can't create database 'PROD'; database exists\")\r\n  result = self._query(query)\r\n```\r\n\r\nI believe it should not show up thanks to the `IF NOT EXISTS` condition. And there seems to be no way to ignore that warning?\r\n\r\nPyMSQL version 0.8.1 with python 3.6.3."},"comment":{"url":"https://api.github.com/repos/PyMySQL/PyMySQL/issues/comments/399013420","html_url":"https://github.com/PyMySQL/PyMySQL/issues/688#issuecomment-399013420","issue_url":"https://api.github.com/repos/PyMySQL/PyMySQL/issues/688","id":399013420,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTAxMzQyMA==","user":{"login":"methane","id":199592,"node_id":"MDQ6VXNlcjE5OTU5Mg==","avatar_url":"https://avatars2.githubusercontent.com/u/199592?v=4","gravatar_id":"","url":"https://api.github.com/users/methane","html_url":"https://github.com/methane","followers_url":"https://api.github.com/users/methane/followers","following_url":"https://api.github.com/users/methane/following{/other_user}","gists_url":"https://api.github.com/users/methane/gists{/gist_id}","starred_url":"https://api.github.com/users/methane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/methane/subscriptions","organizations_url":"https://api.github.com/users/methane/orgs","repos_url":"https://api.github.com/users/methane/repos","events_url":"https://api.github.com/users/methane/events{/privacy}","received_events_url":"https://api.github.com/users/methane/received_events","type":"User","site_admin":false},"created_at":"2018-06-21T08:05:42Z","updated_at":"2018-06-21T08:05:42Z","author_association":"MEMBER","body":"BTW, mysql client has `--show-warnings` option which automatically show warnings, like PyMySQL.\r\nhttps://dev.mysql.com/doc/refman/8.0/en/mysql-command-options.html#option_mysql_show-warnings\r\n\r\nWithout this option, mysql client shows only count of warnings, and you need to execute `SHOW WARNINGS` to see the warning.\r\n\r\n```\r\nmysql> create database IF NOT EXISTS mydatabase;\r\nQuery OK, 1 row affected (0.03 sec)\r\n\r\nmysql> create database IF NOT EXISTS mydatabase;\r\nQuery OK, 1 row affected, 1 warning (0.01 sec)\r\n\r\nmysql> show warnings;\r\n+-------+------+-----------------------------------------------------+\r\n| Level | Code | Message                                             |\r\n+-------+------+-----------------------------------------------------+\r\n| Note  | 1007 | Can't create database 'mydatabase'; database exists |\r\n+-------+------+-----------------------------------------------------+\r\n1 row in set (0.00 sec)\r\n```\r\n\r\nIt's **very** basic knowledge.  You must ask on Stackoverflow, before assuming it's PyMySQL issue."}}
{"actor":{"display_login":"methane"}}