python - Python 到 Firebase
问题描述
我使用python将我的数据上传到firebase,而不是在实时数据库中为我的数据自动生成路径。我怎么能自己做呢?例子:
我不想要 MGRhisI5hSiYUs9fr0s,但我想要我自己的话。这是我的代码:
db = firebase.database()
data_to_upload = {
"result": result
}
db.child("testResult").push(data_to_upload)
解决方案
如果要指定路径,请不要使用push()
,它会生成随机 ID。set()
如文档中所述,构建要更新和使用的位置的路径。
db.child("choose").child("your").child("path").set(data_to_upload)
推荐阅读
- r - 运行 Amelia 包时出现问题 - 不存在变量
- excel-formula - Excel:复杂查找 + '如果单元格包含'
- c# - 使用 LINQtoCSV 格式化十进制列
- javascript - 比较两个数组并找出差异
- twitter-bootstrap - 按钮不会在 Bootstrap 4 的断点处垂直堆叠
- spring - 如何在另一个 Spring Boot jar 项目中从依赖的 Spring Boot 应用程序自动连接数据源?
- linux - 如何在 Visual Studio 的 Linux 控制台窗口中发出文件结束信号
- c# - 当存在验证错误并且许多自定义文本框一个接一个放置时,如何保持自定义文本框的焦点
- flutter - ListView 处理并重新创建所有子项的 State & RenderObject
- ruby-on-rails - Rails 认知复杂度为 6(允许超过 5)