google-cloud-storage

how to get file metadata from GCS

…衆ロ難τιáo~ 提交于 2021-01-28 11:13:38
问题 I would like to get file meta data of file stored in Google Cloud Storage. Actually we require a media link of file so file can be downloaded or url added to page for download. Blob blob = storage.get("gcp-public-data-nexrad-l2", "1991/06/05/KTLX/NWS_NEXRAD_NXL2LG_KTLX_19910605160000_19910605235959.tar"); ReadChannel readChannel = blob.reader(); System.out.println(blob); I am using public bucket, for example, but blob contains metadata=null . Is there any way to get file metadata? Thanks 回答1:

How to append files in GCS with the same schema?

こ雲淡風輕ζ 提交于 2021-01-28 10:50:30
问题 Is there any way one can append two files in GCS, suppose file one is a full load and second file is an incremental load. Then what's the way we can append the two? Secondly, using gsutil compose will append the two files including the attributes names as well. So, in the final file I want the data of the two files. 回答1: You can append two separate files using compose in the Google Cloud Shell and rename the output file as the first file, like this: gsutil compose gs://bucket/obj1 [gs:/

How to append files in GCS with the same schema?

不问归期 提交于 2021-01-28 10:33:07
问题 Is there any way one can append two files in GCS, suppose file one is a full load and second file is an incremental load. Then what's the way we can append the two? Secondly, using gsutil compose will append the two files including the attributes names as well. So, in the final file I want the data of the two files. 回答1: You can append two separate files using compose in the Google Cloud Shell and rename the output file as the first file, like this: gsutil compose gs://bucket/obj1 [gs:/

Content-length header not being set on Flask App Engine response for served blob

…衆ロ難τιáo~ 提交于 2021-01-28 08:04:15
问题 In my Flask-based Google App Engine server, I am trying to return a response with a 'content-length' header which will contain the final size of a blob being served to the client. This blob is a large media file, so this header is going to be used to set the maximum value of a progress bar on the UI frontend. The blob lives in Cloud Storage, but is using the blobstore API from the App Engine packages to retrieve the blob. Below returns with a 200 status code: response.headers['Content-length'

lost permission on my cloud storage bucket, how to reset them?

浪子不回头ぞ 提交于 2021-01-28 07:37:23
问题 I ran gsutil.py acl set -R public-read gs://dsa-assets and now I see that it override every users permission and I can't upload new file or even delete this bucket. What can I do to reset permission on my bucket or to delete this bucket ? 回答1: gsutil acl set -R public-read gs://bucketName will set the ACL for bucketName and all of the objects inside of bucketName to the canned ACL public-read . This ACL grants all users read access to the bucket and objects, and it grants FULL_CONTROL to the

How to ingest data from a GCS bucket via Dataflow as soon as a new file is put into it?

走远了吗. 提交于 2021-01-28 07:37:16
问题 I have a use case where I need to input data from google Cloud Storage bucket as soon as its made available in the form of a new file in a storage bucket via Dataflow . How do I trigger the execution of the Dataflow job as soon as the new data(file) becomes available or added to the storage bucket ? 回答1: If your pipelines are written in Java, then you can use Cloud Functions and Dataflow templating. I'm going to assume you're using 1.x SDK (it's also possible with 2.x) Write your Pipeline and

How can i create bucket on Firebase Cloud Storage

邮差的信 提交于 2021-01-28 05:55:21
问题 I'm a python developer.we use GCS (Google cloud storage) to store our images for past we months which is good but for android it requires to import all the buckets to Firebase Cloud Storage(FCS) for accessing it. We dont want any manual integration. we heard that if we create a bucket on FCS which automatically reflect on GCS which is good and there is no import required. We trying to create bucket directly on firebase cloud storage. may i know is that posstible by programmtically? 回答1: You

Using external data sources in BQ with specific generation from Google Storage

梦想的初衷 提交于 2021-01-28 05:40:30
问题 I want to use external data sources in a BQ select statement with not the latest but a specific generation of a file from Google Cloud Storage. I currently use the following: val sourceFile = "gs://test-bucket/flights.csv" val queryConfig = QueryJobConfiguration.newBuilder(query) .addTableDefinition("tmpTable", ExternalTableDefinition.newBuilder(sourceFile, schema, format) .setCompression("GZIP") .build()) .build(); bigQuery.query(queryConfig) I tried to set the sourceFile variable as follows

Issue with 'google.cloud.storage'. module has no attribute 'Client'

流过昼夜 提交于 2021-01-28 04:08:41
问题 Trying to simply connect to the google-cloud-storage using these instructions; https://googleapis.github.io/google-cloud-python/latest/storage/index.html However, I keep getting the problem with the storage module, no client attribute. from google.cloud import storage # Instantiates a client storage_client = storage.Client(credentials=creds, project='name') # The name for the new bucket bucket_name = 'my-new-bucket' # Creates the new bucket bucket = storage_client.create_bucket(bucket_name)

How to use gsutil compose in GoogleShell and skip first rows?

China☆狼群 提交于 2021-01-28 03:04:49
问题 I am trying to use "compose" command in the shell to merge the files I get in my bucket GCP. Problem appears when this command merges those csv files but does not skip the headers. What I finally get is a merge of 24 csv files but also 24 headers. Trying to do this in python but also no solution. Any help?? 回答1: There doesn't exist any flag on gsutil to skip csv headers but I have this python script that can make the workaround. This script downloads the csv files from the bucket, append them