{"action":"closed","issue":{"url":"https://api.github.com/repos/apache/incubator-airflow/issues/1048","repository_url":"https://api.github.com/repos/apache/incubator-airflow","labels_url":"https://api.github.com/repos/apache/incubator-airflow/issues/1048/labels{/name}","comments_url":"https://api.github.com/repos/apache/incubator-airflow/issues/1048/comments","events_url":"https://api.github.com/repos/apache/incubator-airflow/issues/1048/events","html_url":"https://github.com/apache/incubator-airflow/issues/1048","id":135226893,"number":1048,"title":"Query errors after initdb","user":{"login":"chris-hailstorm","id":1454260,"avatar_url":"https://avatars.githubusercontent.com/u/1454260?v=3","gravatar_id":"","url":"https://api.github.com/users/chris-hailstorm","html_url":"https://github.com/chris-hailstorm","followers_url":"https://api.github.com/users/chris-hailstorm/followers","following_url":"https://api.github.com/users/chris-hailstorm/following{/other_user}","gists_url":"https://api.github.com/users/chris-hailstorm/gists{/gist_id}","starred_url":"https://api.github.com/users/chris-hailstorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chris-hailstorm/subscriptions","organizations_url":"https://api.github.com/users/chris-hailstorm/orgs","repos_url":"https://api.github.com/users/chris-hailstorm/repos","events_url":"https://api.github.com/users/chris-hailstorm/events{/privacy}","received_events_url":"https://api.github.com/users/chris-hailstorm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-21T16:56:50Z","updated_at":"2016-05-08T13:22:15Z","closed_at":"2016-05-08T13:22:15Z","body":"Using a remote MySQL DB, I was able to run `airflow initdb` successfully using this connect string:\r\n\r\n`sql_alchemy_conn = mysql+pymysql://username:password@some.thing.us-west-2.rds.amazonaws.com/schemaname` -- note use of `mysql+pymysql`.\r\n\r\nWhen I try to do something basic in the web UI like click into a DAG, I get a SQL error:\r\n\r\n`ProgrammingError: (pymysql.err.ProgrammingError) (1064, u\"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[(\\\\'dag_id\\\\', u\\\\'example_bash_operator\\\\')]'')' at line 1\") [SQL: u'INSERT INTO log (dttm, dag_id, task_id, event, execution_date, owner, extra) VALUES (%(dttm)s, %(dag_id)s, %(task_id)s, %(event)s, %(execution_date)s, %(owner)s, %(extra)s)'] [parameters: {'task_id': None, 'extra': \"[('dag_id', u'example_bash_operator')]\", 'execution_date': None, 'dttm': datetime.datetime(2016, 2, 21, 11, 54, 18, 218042), 'owner': 'anonymous', 'event': 'graph', 'dag_id': u'example_bash_operator'}]`\r\n\r\nThe stack trace shows this exception being raised from the `pymysql` package. Seems like the SQL syntax is incompatible with the driver and/or the MySQL server version.\r\n\r\nI found this problem can be resolved by switching to the `mysql+mysqldb` driver.  Depending on the client OS, this combination can be a little tricky to install, but nevertheless appears to be the solution.\r\n\r\nRecommendation: do not allow `pymysql` during the initdb phase since it is not yet allowed in the webserver phase.  Provide advice in install doco to use the `mysql+mysqldb` driver only at this time."}}