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

Sqlalchemy adapter #693

Merged
merged 58 commits into from
Apr 29, 2017
Merged

Conversation

davizucon
Copy link
Collaborator

This is the very first release of Sqlalchemy adapter, that have SQLite as default implementation, remains in alpha.

  • Notes:
    • Tables may change (and will), so, save your training data. There no data migration (yet, not for alpha).
    • Performance test not done yet.
    • Tests using others databases not finished.
    • Documentation on the way, any question, go to Create SQLite storage adapter #241 or chat on gitter. (faster with mention)

Thanks,
Davi

davizucon and others added 30 commits August 25, 2016 11:22
…sponse , and setting to lower case fuzz.ratio, sometimes the is not close enough to the right answer (my point of view).
…sponse , and setting to lower case fuzz.ratio, sometimes the is not close enough to the right answer (my point of view).
* upstream:
  Language fix and nltk fix to find correct library
  Fix test missing parameter.
  Add unit test to make sure that extra data is saved to the input statement.
  pass through extra data from the original input
  Add Gitter badge
  Fix broken link to "trainer classes on github"
  Renamed corpus readme files.
  Removed wiki link from readme.
  Fix arguments (+input_statement, statement_list) for most_frequent_response , and setting to lower case fuzz.ratio, sometimes the is not close enough to the right answer (my point of view).
  Update readme.md
  Update readme-es.md
  Update readme.pt.md
  Added Flask example link
  twitter adapter documentation
…sponse , and setting to lower case fuzz.ratio, sometimes the is not close enough to the right answer (my point of view).
assert method for None checks
* upstream/master: (57 commits)
  Added views and settings to Django documentation.
  Update tests now that get_response returns an object.
  Remove output format setter from base test case.
  Removed language filter.
  Added filter test case for reperitive response filter.
  Added base test case for chatbots using Mongo DB
  Make it easier to extend the base test case.
  Added query tests.
  Add test case for new mongo_to_object method.
  Create filter documentation.
  Add filters to the Mongo DB example.
  Finished creating two simple filters.
  Remove base query restriction from get_random
  Add a method to convert Mongo DB results into statement objects.
  Converted mongo adapter to use query builder.
  Make query support for storage adapters optional.
  Create all the filters.
  Added base query support to mongo adapter.
  Added classes for filter objects.
  Avoid problems in str.format() with char accents
  ...

# Conflicts:
#	.gitignore
…o sqlalchemy-adapter

* 'master' of https://github.com/gunthercox/ChatterBot:
  Cast response.content to a string
  Fix unit tests for Django 1.8
  Update Django settings documentation.
  Allow Django app settings to override ChatterBot settings.
  Add name attribute to ChatBot.
  Use a docstring for autodoc detection.
  Update training excption message.
  Update training parameter for docs and examples.
  Document ChatterBot parameters.
  Removed unused variable.
  Training class can now be set as a string passed to the ChatBot constructor.
  Raise an exception if an invalid tie breaking method is used.
  Change read the docs links from latest to stable.
  Update documentation settings.
  Add a favicon to docs.
  Resized logo background to be square.
  Correct static image paths in docs.
  Correct autodoc warnings.
  Added style for docs search header.
  Moved testing documentation from the readme to the docs.
@davizucon
Copy link
Collaborator Author

Finally !

# # properties={
# # 'statement': relationship(Statement, backref='response')
# # }, )
# mapper(Statement, self.statement)
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 you could remove these lines?


return results

# def filter(self, **kwargs):
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 you could remove these lines?

requirements.txt Outdated
@@ -3,3 +3,5 @@ jsondatabase>=0.1.7,<1.0.0
nltk>=3.2.0,<4.0.0
pymongo>=3.3.0,<4.0.0
python-twitter>=3.0.0,<4.0.0
textblob>=0.11.0,<0.12.0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you imported this package? I haven't seen

@@ -2,3 +2,9 @@
from .django_storage import DjangoStorageAdapter
from .jsonfile import JsonFileStorageAdapter
from .mongodb import MongoDatabaseAdapter

# FIXME Better way manage import
try:
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 these files are static and reside in same directory as long as they are. It's always a safe import.

return Response(text=self.text, **occ)


# # relational table TO REMOVE
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 you could remove these lines

Copy link
Collaborator

@vkosuri vkosuri left a comment

Choose a reason for hiding this comment

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

Over all looks good, I think left over part is updating docs

…nd imports in requirements.txt, change imports in sqlalchemy and a little refactor.
@davizucon
Copy link
Collaborator Author

Hi @vkosuri , Indeed.

Copy link
Owner

@gunthercox gunthercox left a comment

Choose a reason for hiding this comment

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

@davizucon This looks good. I'm going to pull it in as an undocumented beta-level feature. Much appreciation for all of your work getting this put together.

@gunthercox gunthercox dismissed vkosuri’s stale review April 29, 2017 11:12

Requested changes have been made.

@gunthercox gunthercox merged commit 6ffb847 into gunthercox:master Apr 29, 2017
@a-elhaddad
Copy link
Contributor

there is any way to see exemple using sqlalchemy ?

@gunthercox
Copy link
Owner

Hi @addelll, you can use this storage adapter the same way that the others are used.

For example,

chatbot = ChatBot(
    "My ChatterBot",
    storage_adapter="chatterbot.storage.SQLAlchemyDatabaseAdapter"
)

Is this what you are looking for as an example?

@a-elhaddad
Copy link
Contributor

AttributeError: module 'chatterbot.storage' has no attribute 'SQLAlchemyDatabaseAdapter' ???

@gunthercox
Copy link
Owner

The reason you are seeing that message is likely because the current version of ChatterBot (0.6.0) doesn't contain the changes that were added in this pull request.

@a-elhaddad
Copy link
Contributor

so any suggestions or i must copy directly from github ??

@gunthercox
Copy link
Owner

One possible way is to install directly from GitHub.

pip install git+git://github.com/gunthercox/ChatterBot.git@master

@a-elhaddad
Copy link
Contributor

a-elhaddad commented May 13, 2017

Thanks @gunthercox but some errors :
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: StatementTable

@gunthercox
Copy link
Owner

@addelll I believe you will need to set create=True when using this adapter for the first time.

@davizucon
Copy link
Collaborator Author

@gunthercox @addelll , Sorry, I'll update documentation, asap.

@a-elhaddad
Copy link
Contributor

@gunthercox @davizucon thanks for the greate work , i need one full exemple using Sqlalchemy adapter because i have some errors after second release in heroku like
Arguments: ('columns text, text_search are not unique',)
I tried to fix that but ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants