Skip to content

Commit

Permalink
db: adding multi database support
Browse files Browse the repository at this point in the history
  • Loading branch information
RustyBower committed Apr 1, 2019
1 parent dafa08a commit b922cfb
Show file tree
Hide file tree
Showing 3 changed files with 294 additions and 92 deletions.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ requests>=2.0.0,<3.0.0
dnspython<2.0; python_version >= '2.7' and python_version < '3.0'
dnspython<1.16.0; python_version == '3.3'
dnspython<3.0; python_version >= '3.4'
sqlalchemy<1.3; python_version == '3.3'
sqlalchemy<1.4; python_version != '3.3'
38 changes: 37 additions & 1 deletion sopel/config/core_section.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,44 @@ class CoreSection(StaticSection):
channels = ListAttribute('channels')
"""List of channels for the bot to join when it connects"""

db_type = ChoiceAttribute('db_type',
choices=['sqlite', 'mysql', 'postgres', 'mssql', 'oracle', 'firebird', 'sybase'],
default='sqlite')
"""The type of database to use for Sopel's database.
mysql - pip install mysql-python (Python 2) or pip install mysqlclient (Python 3)
postgres - pip install psycopg2
mssql - pip install pymssql
See https://docs.sqlalchemy.org/en/latest/dialects/ for a full list of dialects
"""

db_filename = ValidatedAttribute('db_filename')
"""The filename for Sopel's database."""
"""The filename for Sopel's database. (SQLite only)"""

db_driver = ValidatedAttribute('db_driver')
"""The driver for Sopel's database.
This is optional, but can be specified if user wants to use a different driver
https://docs.sqlalchemy.org/en/latest/core/engines.html
"""

db_user = ValidatedAttribute('db_user')
"""The user for Sopel's database."""

db_pass = ValidatedAttribute('db_pass')
"""The password for Sopel's database."""

db_host = ValidatedAttribute('db_host')
"""The host for Sopel's database."""

db_port = ValidatedAttribute('db_port')
"""The port for Sopel's database."""

db_name = ValidatedAttribute('db_name')
"""The name of Sopel's database."""

default_time_format = ValidatedAttribute('default_time_format',
default='%Y-%m-%d - %T%Z')
Expand Down
Loading

0 comments on commit b922cfb

Please sign in to comment.