diff --git a/mindsdb_sql/parser/dialects/mindsdb/knowledge_base.py b/mindsdb_sql/parser/dialects/mindsdb/knowledge_base.py index a483e870..66f58b68 100644 --- a/mindsdb_sql/parser/dialects/mindsdb/knowledge_base.py +++ b/mindsdb_sql/parser/dialects/mindsdb/knowledge_base.py @@ -8,7 +8,7 @@ def __init__( name, model, storage, - from_query=None, + from_select=None, params=None, if_not_exists=False, *args, @@ -20,7 +20,7 @@ def __init__( self.storage = storage self.params = params self.if_not_exists = if_not_exists - self.from_query = from_query + self.from_query = from_select def to_tree(self, *args, level=0, **kwargs): ind = indent(level) diff --git a/mindsdb_sql/parser/dialects/mindsdb/parser.py b/mindsdb_sql/parser/dialects/mindsdb/parser.py index 03c6ff6f..f1286b9c 100644 --- a/mindsdb_sql/parser/dialects/mindsdb/parser.py +++ b/mindsdb_sql/parser/dialects/mindsdb/parser.py @@ -110,7 +110,7 @@ def create_kb(self, p): name=name, model=model, storage=storage, - from_query=from_query, + from_select=from_query, params=params, if_not_exists=if_not_exists ) diff --git a/tests/test_parser/test_mindsdb/test_knowledgebase.py b/tests/test_parser/test_mindsdb/test_knowledgebase.py index fe9e7c80..cfe68a3c 100644 --- a/tests/test_parser/test_mindsdb/test_knowledgebase.py +++ b/tests/test_parser/test_mindsdb/test_knowledgebase.py @@ -31,7 +31,7 @@ def test_create_knowledeg_base(): if_not_exists=False, model=Identifier(parts=["mindsdb", "my_embedding_model"]), storage=Identifier(parts=["my_vector_database", "some_table"]), - from_query=None, + from_select=None, params={}, ) assert ast == expected_ast @@ -63,7 +63,7 @@ def test_create_knowledeg_base(): if_not_exists=False, model=Identifier(parts=["mindsdb", "my_embedding_model"]), storage=Identifier(parts=["my_vector_database", "some_table"]), - from_query=Select( + from_select=Select( targets=[ Identifier("id"), Identifier("content"), @@ -113,7 +113,7 @@ def test_create_knowledeg_base(): if_not_exists=True, model=Identifier(parts=["mindsdb", "my_embedding_model"]), storage=Identifier(parts=["my_vector_database", "some_table"]), - from_query=None, + from_select=None, params={}, ) assert ast == expected_ast @@ -133,7 +133,7 @@ def test_create_knowledeg_base(): if_not_exists=False, model=Identifier(parts=["mindsdb", "my_embedding_model"]), storage=Identifier(parts=["my_vector_database", "some_table"]), - from_query=None, + from_select=None, params={"some_param": "some value", "other_param": "other value"}, ) assert ast == expected_ast