本文介绍了设置与Airflow的MongoDB连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据天文学家文档
尽管如此,我仍然不确定如何在Extras中构造JSON.我试过了: {uri:mongodb + srv://myuser:[email protected]/mydb?retryWrites = true& w = majority}
,但这不是工作:
这看起来应该很明显,但是我正在努力.使用我们来自MongoDB Atlas的MongoDB URI在Airflow中创建此连接的正确方法是什么?
解决方案
这是我会尝试的:
- Conn类型:
mongodb + srv
(或mongodb
) - 主机:
my-cluster.blahlah.mongodb.net
, - 登录名:
<用户名>
,密码:< password>
. - 模式:管理员(或您的authDB)
- 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:[email protected]/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:
- Conn Type:
mongodb+srv
(ormongodb
) - Host:
my-cluster.blahlah.mongodb.net
, - Login:
<username>
, Password:<password>
. - Schema: admin (or your authDB)
- The JSON object is as simple as this
{ retryWrite:true,
<field>:value,
w:majority
}
这篇关于设置与Airflow的MongoDB连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!