FEATURE add possibilitty to make chain join
Add possibility to chain join.
For the moment we can't because join build himself and launch the build of context and terminal command.
In the file consult.py
lines 427/428
_build_join_clauses(result, paths, join_type)
_build_context_and_terminal(result, sqle, built_commands)
We need to accept join in _build_context_and_terminal
only for join. Or create a function like build_chain_join
because a second join had the same result_function
(need to concat different result_function
)
Tests for this:
def test_execute_more_then_1_join(
db_connection_with_data,
table_objects,
table_satellite,
table_disks,
):
conn = db_connection_with_data
record = (
SQLEnumerable(conn, table_objects)
.join(
inner=SQLEnumerable(conn, table_satellite),
outer_key=lambda objects: objects.id,
inner_key=lambda satellite: satellite.data.obj.owner_id,
result_function=lambda satellite, objects: {
"satellite_name": satellite.data.obj.name,
"object_name": objects.data.obj.name,
},
)
.join(
inner=SQLEnumerable(conn, table_disks),
outer_key=lambda objects: objects.id,
inner_key=lambda disks: disks.data.owner_id,
result_function=lambda disks, objects: {
"disks_name": disks.obj.name,
},
)
.get_command()
)
print(record)
assert False
# TODO: more then 1 join and cmd