@@ -133,8 +133,9 @@ Scopes (comma separated)
133
133
Scopes are ignored when using application default credentials. See
134
134
issue `AIRFLOW-2522
135
135
<https://issues.apache.org/jira/browse/AIRFLOW-2522> `_.
136
+
136
137
MySQL
137
- ~~~~~~~~~~~~~~~~~~~~~
138
+ ~~~~~
138
139
The MySQL connect type allows to connect with MySQL database.
139
140
140
141
Configuring the Connection
@@ -152,7 +153,61 @@ Password (required)
152
153
Specify the password to connect.
153
154
154
155
Extra (optional)
155
- Specify the charset. Example: {"charset": "utf8"}
156
-
156
+ Specify the extra parameters (as json dictionary) that can be used in mysql
157
+ connection. The following parameters are supported:
158
+
159
+ * **charset **: specify charset of the connection
160
+ * **cursor **: one of "sscursor", "dictcursor, "ssdictcursor" - specifies cursor class to be
161
+ used
162
+ * **local_infile **: controls MySQL's LOCAL capability (permitting local data loading by
163
+ clients). See `MySQLdb docs <https://mysqlclient.readthedocs.io/user_guide.html >`_
164
+ for details.
165
+ * **unix_socket **: UNIX socket used instead of the default socket
166
+ * **ssl **: Dictionary of SSL parameters that control connecting using SSL (those
167
+ parameters are server specific and should contain "ca", "cert", "key", "capath",
168
+ "cipher" parameters. See
169
+ `MySQLdb docs <https://mysqlclient.readthedocs.io/user_guide.html >`_ for details.
170
+ Note that in order to be useful in URL notation, this parameter might also be
171
+ a string where the SSL dictionary is a string-encoded JSON dictionary.
172
+
173
+ Example "extras" field:
174
+
175
+ .. code-block :: json
176
+
177
+ {
178
+ "charset" : " utf8" ,
179
+ "cursorclass" : " sscursor" ,
180
+ "local_infile" : true ,
181
+ "unix_socket" : " /var/socket" ,
182
+ "ssl" : {
183
+ "cert" : " /tmp/client-cert.pem" ,
184
+ "ca" : " /tmp/server-ca.pem'" ,
185
+ "key" : " /tmp/client-key.pem"
186
+ }
187
+ }
188
+
189
+ or
190
+
191
+ .. code-block :: json
192
+
193
+ {
194
+ "charset" : " utf8" ,
195
+ "cursorclass" : " sscursor" ,
196
+ "local_infile" : true ,
197
+ "unix_socket" : " /var/socket" ,
198
+ "ssl" : " {\" cert\" : \" /tmp/client-cert.pem\" , \" ca\" : \" /tmp/server-ca.pem\" , \" key\" : \" /tmp/client-key.pem\" }"
199
+ }
200
+
201
+ When specifying the connection as URI (in AIRFLOW_CONN_* variable) you should specify it
202
+ following the standard syntax of DB connections, where extras as passed as parameters
203
+ of the URI (note that all components of the URI should be URL-encoded).
204
+
205
+ For example:
206
+
207
+ .. code-block :: bash
208
+
209
+ mysql://mysql_user:XXXXXXXXXXXX@1.1.1.1:3306/mysqldb? ssl=%7B%22cert%22%3A+%22%2Ftmp%2Fclient-cert.pem%22%2C+%22ca%22%3A+%22%2Ftmp%2Fserver-ca.pem%22%2C+%22key%22%3A+%22%2Ftmp%2Fclient-key.pem%22%7D
210
+
157
211
.. note ::
158
- If encounter UnicodeDecodeError while working with MySQL connection check the charset defined is matched to the database charset.
212
+ If encounter UnicodeDecodeError while working with MySQL connection check
213
+ the charset defined is matched to the database charset.
0 commit comments