Skip to content

Conversation

@ea-rus
Copy link
Collaborator

@ea-rus ea-rus commented Jan 23, 2025

Implements API added in https://github.com/mindsdb/mindsdb_gateway/pull/974

It allows to limit tables of datasource used by mind only in context of the mind. It is done without modifying datasource.

Usage:

from minds.datasources.datasources import DatabaseTables
datasource = DatabaseTables(
    name='my_db',                 # use existed datasource name
    tables=['table1', 'table1'],  # add limitation for used tables
)
mind4 = client.minds.create(name='mind_name', datasources=[datasource])

Fixes: https://linear.app/mindsdb/issue/BE-610/create-mind-use-list-of-tables-for-datasource

@trag-bot
Copy link

trag-bot bot commented Jan 23, 2025

👋 Hey! As a free user, you're receiving reviews for every 5th PR. Upgrade to get reviews on every pull request and boost your code quality! Learn more here 🚀

@trag-bot
Copy link

trag-bot bot commented Jan 23, 2025

Pull request summary

  • Added a new DatabaseTables class to define data sources with specific table restrictions.
  • Updated the README.md to include examples of creating minds with table-restricted data sources.
  • Modified the examples/base_usage.py to demonstrate the use of the new DatabaseTables class.
  • Refactored the datasources.py file to introduce a base class DatabaseConfigBase for better structure.
  • Enhanced the _check_datasource method to return a dictionary containing both the name and tables of the data source.
  • Updated the create and update methods in minds.py to handle the new data source structure.
  • Adjusted integration tests in test_base_flow.py to validate the functionality of minds with table-restricted data sources.
  • Modified unit tests in test_unit.py to ensure proper handling of the new data source format.
  • Ensured backward compatibility by maintaining existing functionality while introducing new features.
  • Improved code readability and maintainability through consistent naming conventions and structured class definitions.

@ZoranPandovski ZoranPandovski merged commit e2a908b into main Jan 27, 2025
6 checks passed
@ZoranPandovski ZoranPandovski deleted the ds-tables branch January 27, 2025 12:19
@mindsdb mindsdb locked and limited conversation to collaborators Jan 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants