创建数据: insert()
对表执行 INSERT.
final res = await supabase
.from('cities')
.insert([
{'name': 'The Shire', 'country_id': 554}
]).execute();
Notes
- 默认情况下,每次运行时insert(),客户端库都会生成一个select以返回完整记录。这很方便,但如果您的策略未配置为允许select操作,它也会导致问题。如果您正在使用行级安全性并且遇到问题,请尝试将returning参数设置为minimal。
Examples
创建记录
final res = await supabase
.from('cities')
.insert([
{'name': 'The Shire', 'country_id': 554}
]).execute();
批量创建
final res = await supabase
.from('cities')
.insert([
{'name': 'The Shire', 'country_id': 554},
{'name': 'Rohan', 'country_id': 555},
]).execute();