Skip to content

Commit

Permalink
test single_integration
Browse files Browse the repository at this point in the history
  • Loading branch information
ea-rus committed Nov 11, 2024
1 parent 2fb6ce4 commit 5e594fb
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion tests/test_planner/test_integration_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def test_select_from_table_subselect_api_integration(self):
plan = plan_query(
query,
integrations=[{'name': 'int1', 'class_type': 'api', 'type': 'data'}],
predictor_metadata=[{'name': 'pred', 'integration_name': 'mindsdb'}]
predictor_metadata=[{'name': 'pred', 'integration_name': 'mindsdb'}],
)

assert plan.steps == expected_plan.steps
Expand Down Expand Up @@ -583,6 +583,47 @@ def test_select_from_table_subselect_sql_integration(self):

assert plan.steps == expected_plan.steps

def test_select_from_single_integration(self):
sql_parsed = '''
with tab2 as (
select * from int1.tabl2
)
select x from tab2
join int1.tab1 on 0=0
where x1 in (select id from int1.tab1)
limit 1
'''

sql_integration = '''
with tab2 as (
select * from tabl2
)
select x from tab2
join tab1 on 0=0
where x1 in (select id as id from tab1)
limit 1
'''
query = parse_sql(sql_parsed, dialect='mindsdb')

expected_plan = QueryPlan(
predictor_namespace='mindsdb',
steps=[
FetchDataframeStep(
integration='int1',
query=parse_sql(sql_integration),
),
],
)

plan = plan_query(
query,
integrations=[{'name': 'int1', 'class_type': 'sql', 'type': 'data'}],
predictor_metadata=[{'name': 'pred', 'integration_name': 'mindsdb'}],
default_namespace='mindsdb',
)

assert plan.steps == expected_plan.steps

def test_delete_from_table_subselect_api_integration(self):
query = parse_sql('''
delete from int1.tab1
Expand Down

0 comments on commit 5e594fb

Please sign in to comment.