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 support for MySQL database #556

Merged
merged 4 commits into from
Nov 5, 2020
Merged

Add support for MySQL database #556

merged 4 commits into from
Nov 5, 2020

Conversation

tanaysoni
Copy link
Contributor

This PR adds makes the SQLDocumentStore more generic to work with MySQL database.

Resolves #543.

@tanaysoni tanaysoni changed the title WIP: Add support for MySQL database Add support for MySQL database Nov 5, 2020
@tanaysoni tanaysoni requested a review from tholor November 5, 2020 15:47
Copy link
Member

@tholor tholor left a comment

Choose a reason for hiding this comment

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

LGTM!

value = Column(String, index=True)
document_id = Column(String, ForeignKey("document.id", ondelete="CASCADE"), nullable=False)
name = Column(String(100), index=True)
value = Column(String(100), index=True)
Copy link
Contributor

@lalitpagaria lalitpagaria Nov 5, 2020

Choose a reason for hiding this comment

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

Title of the doc is stored as value of meta.name key and there is possibility that it can breach 100 char limit. And if Text is used then need to consider how Text filed is indexed. I feel high value for this would be good ie 1024 or 512.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well spotted @lalitpagaria! I switched the value field to Text.

value = Column(String, index=True)
document_id = Column(String, ForeignKey("document.id", ondelete="CASCADE"), nullable=False)
name = Column(String(100), index=True)
value = Column(Text, index=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

As per mysql docs -

BLOB and TEXT columns also can be indexed, but a prefix length must be given.

I think one integration test with mysql will show these issue if any.

Copy link
Contributor Author

@tanaysoni tanaysoni Nov 5, 2020

Choose a reason for hiding this comment

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

I think we could revert to a larger string field instead of text as you suggested earlier. I tested that the tables get created without any errors on a MySQL instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes I agree with you.

@tanaysoni tanaysoni merged commit d744dc1 into master Nov 5, 2020
@tanaysoni tanaysoni deleted the mysql-support branch November 5, 2020 16:39
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.

FAISSDocumentStore + mysql 5.7
3 participants