@@ -14,6 +14,7 @@ def list_params() -> bool:
14
14
{"name" : "user" , "type" : "string" , "required" : True , "default" : "root" , "description" : "" },
15
15
{"name" : "password" , "type" : "string" , "required" : False , "default" : "" , "description" : "leave blank for no password" },
16
16
{"name" : "host" , "type" : "string" , "required" : True , "default" : "localhost" , "description" : "" },
17
+ {"name" : "port" , "type" : "int" , "required" : False , "default" : 3306 , "description" : "MySQL server port (default 3306)" },
17
18
{"name" : "database" , "type" : "string" , "required" : True , "default" : "mysql" , "description" : "" }
18
19
]
19
20
return params_list
@@ -25,23 +26,24 @@ def auth_instructions() -> str:
25
26
26
27
1. Local MySQL Setup:
27
28
- Ensure MySQL server is running on your machine
28
- - Default connection: host='localhost', user='root'
29
+ - Default connection: host='localhost', user='root', port=3306
29
30
- If you haven't set a root password, leave password field empty
30
31
31
32
2. Remote MySQL Connection:
32
- - Obtain host address, username, and password from your database administrator
33
+ - Obtain host address, port, username, and password from your database administrator
33
34
- Ensure the MySQL server allows remote connections
34
35
- Check that your IP is whitelisted in MySQL's user permissions
35
36
36
37
3. Common Connection Parameters:
37
38
- user: Your MySQL username (default: 'root')
38
39
- password: Your MySQL password (leave empty if no password set)
39
40
- host: MySQL server address (default: 'localhost')
41
+ - port: MySQL server port (default: 3306)
40
42
- database: Target database name to connect to
41
43
42
44
4. Troubleshooting:
43
45
- Verify MySQL service is running: `brew services list` (macOS) or `sudo systemctl status mysql` (Linux)
44
- - Test connection: `mysql -u [username] -p -h [host] [database]`
46
+ - Test connection: `mysql -u [username] -p -h [host] -P [port] [database]`
45
47
"""
46
48
47
49
def __init__ (self , params : Dict [str , Any ], duck_db_conn : duckdb .DuckDBPyConnection ):
@@ -54,7 +56,7 @@ def __init__(self, params: Dict[str, Any], duck_db_conn: duckdb.DuckDBPyConnecti
54
56
55
57
attatch_string = ""
56
58
for key , value in self .params .items ():
57
- if value :
59
+ if value is not None and value != "" :
58
60
attatch_string += f"{ key } ={ value } "
59
61
60
62
# Detach existing mysqldb connection if it exists
0 commit comments