<tfoot id='VjoXJ'></tfoot>
  1. <legend id='VjoXJ'><style id='VjoXJ'><dir id='VjoXJ'><q id='VjoXJ'></q></dir></style></legend>
  2. <i id='VjoXJ'><tr id='VjoXJ'><dt id='VjoXJ'><q id='VjoXJ'><span id='VjoXJ'><b id='VjoXJ'><form id='VjoXJ'><ins id='VjoXJ'></ins><ul id='VjoXJ'></ul><sub id='VjoXJ'></sub></form><legend id='VjoXJ'></legend><bdo id='VjoXJ'><pre id='VjoXJ'><center id='VjoXJ'></center></pre></bdo></b><th id='VjoXJ'></th></span></q></dt></tr></i><div id='VjoXJ'><tfoot id='VjoXJ'></tfoot><dl id='VjoXJ'><fieldset id='VjoXJ'></fieldset></dl></div>
  3. <small id='VjoXJ'></small><noframes id='VjoXJ'>

        <bdo id='VjoXJ'></bdo><ul id='VjoXJ'></ul>

      通过云函数从云存储中读取数据

      Reading Data From Cloud Storage Via Cloud Functions(通过云函数从云存储中读取数据)
      <legend id='wJ17l'><style id='wJ17l'><dir id='wJ17l'><q id='wJ17l'></q></dir></style></legend>
            <tbody id='wJ17l'></tbody>
          <tfoot id='wJ17l'></tfoot>
          <i id='wJ17l'><tr id='wJ17l'><dt id='wJ17l'><q id='wJ17l'><span id='wJ17l'><b id='wJ17l'><form id='wJ17l'><ins id='wJ17l'></ins><ul id='wJ17l'></ul><sub id='wJ17l'></sub></form><legend id='wJ17l'></legend><bdo id='wJ17l'><pre id='wJ17l'><center id='wJ17l'></center></pre></bdo></b><th id='wJ17l'></th></span></q></dt></tr></i><div id='wJ17l'><tfoot id='wJ17l'></tfoot><dl id='wJ17l'><fieldset id='wJ17l'></fieldset></dl></div>

          <small id='wJ17l'></small><noframes id='wJ17l'>

            • <bdo id='wJ17l'></bdo><ul id='wJ17l'></ul>
              • 本文介绍了通过云函数从云存储中读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在尝试快速验证在 Python 中构建数据处理管道的概念.为此,我想构建一个 Google 函数,当某些 .csv 文件被放入 Cloud Storage 时会触发该函数.

                I am trying to do a quick proof of concept for building a data processing pipeline in Python. To do this, I want to build a Google Function which will be triggered when certain .csv files will be dropped into Cloud Storage.

                我遵循 此 Google Functions Python 教程,而示例代码确实如此当文件被删除时触发函数创建一些简单的日志,我真的被困在我必须进行的调用才能真正读取数据的内容.我尝试搜索 SDK/API 指导文档,但找不到.

                I followed along this Google Functions Python tutorial and while the sample code does trigger the Function to create some simple logs when a file is dropped, I am really stuck on what call I have to make to actually read the contents of the data. I tried to search for an SDK/API guidance document but I have not been able to find it.

                如果这是相关的,一旦我处理了 .csv,我希望能够将我从中提取的一些数据添加到 GCP 的 Pub/Sub 中.

                In case this is relevant, once I process the .csv, I want to be able to add some data that I extract from it into GCP's Pub/Sub.

                推荐答案

                该函数实际上并不接收文件的内容,只是一些关于它的元数据.

                The function does not actually receive the contents of the file, just some metadata about it.

                您需要使用 google-cloud-storage 客户端.有关更多信息,请参阅下载对象"指南详情.

                You'll want to use the google-cloud-storage client. See the "Downloading Objects" guide for more details.

                将它与您正在使用的教程放在一起,您将获得如下功能:

                Putting that together with the tutorial you're using, you get a function like:

                from google.cloud import storage
                
                storage_client = storage.Client()
                
                def hello_gcs_generic(data, context):
                    bucket = storage_client.get_bucket(data['bucket'])
                    blob = bucket.blob(data['name'])
                    contents = blob.download_as_string()
                    # Process the file contents, etc...
                

                这篇关于通过云函数从云存储中读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)

                <legend id='SHSTo'><style id='SHSTo'><dir id='SHSTo'><q id='SHSTo'></q></dir></style></legend>

                      <bdo id='SHSTo'></bdo><ul id='SHSTo'></ul>

                      <small id='SHSTo'></small><noframes id='SHSTo'>

                      <i id='SHSTo'><tr id='SHSTo'><dt id='SHSTo'><q id='SHSTo'><span id='SHSTo'><b id='SHSTo'><form id='SHSTo'><ins id='SHSTo'></ins><ul id='SHSTo'></ul><sub id='SHSTo'></sub></form><legend id='SHSTo'></legend><bdo id='SHSTo'><pre id='SHSTo'><center id='SHSTo'></center></pre></bdo></b><th id='SHSTo'></th></span></q></dt></tr></i><div id='SHSTo'><tfoot id='SHSTo'></tfoot><dl id='SHSTo'><fieldset id='SHSTo'></fieldset></dl></div>
                    • <tfoot id='SHSTo'></tfoot>
                          <tbody id='SHSTo'></tbody>