@@ -16,18 +16,6 @@ def __init__(self):
1616 self .lancedb_uri = os .getenv ("LANCEDB_URI" , "s3://emr-serverless-sdk/lance_catalog/default/imdb_top_1000" )
1717 self .lancedb_metadata_uri = os .getenv ("LANCEDB_METADATA_URI" , "s3://emr-serverless-sdk/lance_catalog/default/metadata_table" )
1818
19- # Retrieve STS from IAM Role
20- self .access_key = os .getenv ("VOLCENGINE_ACCESS_KEY" )
21- self .secret_key = os .getenv ("VOLCENGINE_SECRET_KEY" )
22- self .session_token = ""
23-
24- if not (self .access_key and self .secret_key ):
25- # try to get from vefaas iam
26- cred = get_credential_from_vefaas_iam ()
27- self .access_key = cred .access_key_id
28- self .secret_key = cred .secret_access_key
29- self .session_token = cred .session_token
30-
3119 self .tos_region = os .getenv ("TOS_REGION" , "cn-beijing" )
3220 self .lancedb_aws_endpoint = os .getenv ("LANCEDB_AWS_ENDPOINT" , "" )
3321
@@ -58,7 +46,8 @@ def _split_db_and_table(self, uri: str) -> Tuple[Optional[str], Optional[str]]:
5846 return db_root_uri , table_name
5947
6048 def _storage_options (self , uri : str ) -> dict :
61- """Build storage options for LanceDB connection based on URI and environment variables."""
49+ """LanceDB storage_options:
50+ Build storage options for LanceDB connection based on URI and environment variables."""
6251 endpoint = self .lancedb_aws_endpoint
6352 if not endpoint and uri and (uri .startswith ("s3://" ) or uri .startswith ("tos://" )):
6453 no_scheme = uri [len ("s3://" ):]
@@ -68,6 +57,8 @@ def _storage_options(self, uri: str) -> dict:
6857 opts = {
6958 "aws_endpoint" : endpoint ,
7059 "virtual_hosted_style_request" : "true" ,
60+ "aws_unsigned_payload" : "true" ,
61+ "skip_signature" : "true" ,
7162 }
7263 return opts
7364
@@ -76,12 +67,6 @@ def open_table(self, table_name: Optional[str] = None, uri: Optional[str] = None
7667 target_uri = uri or self .lancedb_uri
7768 cache_key = target_uri + (f":{ table_name } " if table_name else "" )
7869
79- if not self .access_key or not self .secret_key :
80- console .error (
81- "Error: VOLCENGINE_ACCESS_KEY and VOLCENGINE_SECRET_KEY are not provided or IAM Role is not configured."
82- )
83- return None , "Error: VOLCENGINE_ACCESS_KEY and VOLCENGINE_SECRET_KEY are not provided or IAM Role is not configured."
84-
8570 # Return cached table if exists
8671 if cache_key in self ._tables :
8772 return self ._tables [cache_key ], None
0 commit comments