Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Set DBName for DB connection #3

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions wadebug/wa_actions/mysql_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@


class MySQLUtil:
def __init__(self, host="", port=0, user="", password=""):
if host and port and user and password:
def __init__(self, host="", port=0, user="", password="", name=""):
if host and port and user and password and name:
self.db_host = host
self.db_port = int(port)
self.db_user = user
self.db_password = password
self.db_name = name
else:
raise ValueError("Wrong input parameters")

Expand All @@ -24,6 +25,7 @@ def create_connection(self):
port=self.db_port,
user=self.db_user,
password=self.db_password,
database = self.db_name,
cursorclass=pymysql.cursors.DictCursor,
)
return connection
Expand Down
3 changes: 2 additions & 1 deletion wadebug/wadebug.conf.yml.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ db:
user: # for example, "root"
# password of the username that is used to connect to the MySQL database
password: # for example, "your_database_password"

# db name that is used to connect to the MySQL database
name: # for example, "your_db_name"
# configurations related to WhatsApp Business API
webapp:
# url accessible from the host running wadebug
Expand Down