Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Deploying LanceDB on google cloud run - having trouble connecting to LanceDB in gcp bucket#2385

Unanswered
hibajamal asked this question inQ&A
Discussion options

As stated by the title, i have my lancedb table in a gcp bucket, and when i run this locally, it works fine. The code is as follows:

self.db = lancedb.connect(                        self.lancedb_path,                        storage_options={                            "service_account": creds_path,                        }            )

^ this works fine locally, but I have a lot of trouble connecting it in cloud run, with this particular GOOGLE_APPLICATION_CREDENTIALS (creds_path) not being able to connect properly to lancedb.
The docs say that this would work:

import lancedbdb = lancedb.connect("gs://bucket/path")

But, this doesn't work, neither locally nor in the cloud.
Does anyone know how to make this work? Could really appreciate some help!

Edit: What's painful in navigating this is when the connection fails, I don't really get to know: since lancedb creates a local table with the same name as the gcp bucket.

You must be logged in to vote

Replies: 1 comment 3 replies

Comment options

By "run this locally" do you mean you are connecting to GCP from your local laptop? Or connecting to a local path?

but I have a lot of trouble connecting it in cloud run, with this particular GOOGLE_APPLICATION_CREDENTIALS (creds_path) not being able to connect properly to lancedb.

How are you configuring lancedb to point at the credentials?

You must be logged in to vote
3 replies
@hibajamal
Comment options

Hey! thanks for responding. Yes, i do mean i'm connecting to GCP from a local laptop.

Locally, what works is the first code snippet i attached, the creds_path is just a string containing the path to the service account json, since even with GOOGLE_APPLICATION_CREDENTIALS set, just the gs:// path did not suffice.

However, with the cloud run application, none of this works. Including using all appropriate options mentioned in the docs here:https://lancedb.github.io/lancedb/guides/storage/#google-cloud-storage.

Usually, for google clients, setting the path to service account is not necessary in cloud run, as long as the service account connected to the cloud run container has the necessary permissions (which it does). I still can't connect to the bucket through the .connect() function.

@westonpace
Comment options

Usually, for google clients, setting the path to service account is not necessary in cloud run, as long as the service account connected to the cloud run container has the necessary permissions (which it does). I still can't connect to the bucket through the .connect() function.

I agree this is the standard and much easier path. That is normally how I setup GCP instances as well. I configure the VM to have a service account with the appropriate credentials and then check the "Allow full access to all Cloud APIs" checkbox. After that I'm usually able to usegs:// URLs without any storage options. I haven't used cloud run before but can maybe give it a try.

Locally, what works is the first code snippet i attached, the creds_path is just a string containing the path to the service account json, since even with GOOGLE_APPLICATION_CREDENTIALS set, just the gs:// path did not suffice.

I think the environment variables for a service account json file areGOOGLE_SERVICE_ACCOUNT,GOOGLE_SERVICE_ACCOUNT_PATH, orSERVICE_ACCOUNT (these are all aliases). I believe thatGOOGLE_APPLICATION_CREDENTIALS is for using a service account key or "Workforce Identity Federation".

@hibajamal
Comment options

The service account has the required permissions, I just created a new one and deployed it to check if it works but it doesn't.

Also, the "Allow full access to all Cloud APIs" is I think the option that shows up when creating a VM but not Cloud run - my project is in a container deployed with cloud run.

As for theGOOGLE_APPLICATION_CREDENTIALS env variable, my bad - i had set that but was just using the other aliases for the storage options route.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@hibajamal@westonpace

[8]ページ先頭

©2009-2025 Movatter.jp