Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sqlite pragma settings to sql_storage.py - change distinct to aggregate in mongodb.py #916

Merged
merged 18 commits into from
Aug 11, 2017
Merged
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
11 changes: 11 additions & 0 deletions chatterbot/storage/sql_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ def __init__(self, **kwargs):

self.engine = create_engine(self.database_uri, convert_unicode=True)

from re import search

if search('^sqlite://', self.database_uri):
from sqlalchemy.engine import Engine
from sqlalchemy import event

@event.listens_for(Engine, "connect")
def set_sqlite_pragma(dbapi_connection, connection_record):
dbapi_connection.execute('PRAGMA journal_mode=WAL')
dbapi_connection.execute('PRAGMA synchronous=NORMAL')

self.read_only = self.kwargs.get(
"read_only", False
)
Expand Down
2 changes: 1 addition & 1 deletion examples/learning_feedback_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
output_adapter='chatterbot.output.TerminalAdapter'
)

DEFAULT_SESSION_ID = bot.default_session.id
DEFAULT_SESSION_ID = bot.default_conversation_id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could also rephrase to DEFAULT_CONVERSATION_ID

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.



def get_feedback():
Expand Down
2 changes: 1 addition & 1 deletion examples/learning_new_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

bot.train("chatterbot.corpus.english")

DEFAULT_SESSION_ID = bot.default_session.id
DEFAULT_SESSION_ID = bot.default_conversation_id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could also rephrase to DEFAULT_CONVERSATION_ID

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.



def get_feedback():
Expand Down