多表关联支持吗?
-
使用的MemFire Cloud,多表关联支持吗,多表关联计算,使用多个sql语句能否自动生成接口?
-
@xiaona @xiaona MemFire Cloud支持多表关联,
使用python进行多表关联查询,可以参考:https://community.memfiredb.com/topic/311/使用python接口来进行关联查询操作
使用JS进行多表关联查询,可以参考:
https://supabase.com/docs/reference/javascript/select
例如:Query foreign tables
建表:create table countries (id int8 primary key, name text); create table cities ( id int8 primary key, country_id int8 not null references countries, name text );
查询
const { data, error } = await supabase .from('countries') .select(` name, cities ( name ) `)
返回结果
{ "data": [ { "name": "Germany", "cities": [ { "name": "Munich" } ] }, { "name": "Indonesia", "cities": [ { "name": "Bali" } ] } ], "status": 200, "statusText": "OK" }