设置与Airflow的MongoDB连接 [英] Setting MongoDB connection with Airflow

查看:101
本文介绍了设置与Airflow的MongoDB连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据天文学家文档

尽管如此,我仍然不确定如何在Extras中构造JSON.我试过了: {uri:mongodb + srv://myuser:mypass@my-cluster.dwxnd.gcp.mongodb.net/mydb?retryWrites = true& w = majority} ,但这不是工作:

这看起来应该很明显,但是我正在努力.使用我们来自MongoDB Atlas的MongoDB URI在Airflow中创建此连接的正确方法是什么?

解决方案

这是我会尝试的:

  1. Conn类型: mongodb + srv (或 mongodb )
  2. 主机: my-cluster.blahlah.mongodb.net
  3. 登录名:<用户名> ,密码:< password> .
  4. 模式:管理员(或您的authDB)
  5. JSON对象就是这么简单

  {retryWrite:true,< field> ;:值,w:多数} 

According to Astronomer docs here:

Despite this, I'm still not quite sure how to structure the JSON in Extras for this. I've tried: { uri: mongodb+srv://myuser:mypass@my-cluster.dwxnd.gcp.mongodb.net/mydb?retryWrites=true&w=majority } in the Extras but that doesn't work:

It seems like this should be obvious, yet I am struggling. What's the correct way, using our MongoDB URI from MongoDB Atlas, to create this connection in Airflow?

解决方案

This is what I would try:

  1. Conn Type: mongodb+srv (or mongodb)
  2. Host:my-cluster.blahlah.mongodb.net,
  3. Login: <username>, Password: <password>.
  4. Schema: admin (or your authDB)
  5. The JSON object is as simple as this

{ retryWrite:true, 
  <field>:value, 
  w:majority
}

这篇关于设置与Airflow的MongoDB连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆