ImportError:尝试将数据提交到数据流中的Firestore时

我目前正在尝试将数据从python apache beam数据流管道提交到firestore。

但是我一直在得到错误

我目前正在函数内部调用firebase_admin,尽管与在文件开头调用它相比并没有什么不同。


class FireBatch(beam.DoFn):

    def process(self, element):

        """

        Make a batch element and send to firestore

        """

        import firebase_admin

        from firebase_admin import credentials

        from firebase_admin import firestore


        cred = credentials.Certificate('./creds/pipeCreds.json')

        firebase_admin.initialize_app(cred)


        db = firestore.Client()

有没有一种方法可以使数据流识别管道中的firebase_admin?还是将数据从管道提交到Firestore?


我已经安装了所有必需的软件包,升级了pip,刷新了凭据,尝试使用google.cloud.firestore而不是fire_base admin。


宝慕林4294392
浏览 159回答 1
1回答

www说

这个问题是由于没有使用Google SDK进行初始化,我试图用GitBash进行初始化,显然配置没有正确设置。下一步是使用Requirements.txt文件初始化应用程序。pip freeze > requirements.txt之后,仅将应用程序所需的文件包括在requirements.txt文件中,并通过添加以下内容来初始化应用程序:--requirements_file requirements.txt另外,有必要从更改为firebase_admin==2.11.0,firebase_admin==2.8.0因为这会引起错误。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python