Skip to content

Conversation

@aaarendt
Copy link
Contributor

This PR adds a function URL enabling a publicly accessible dedicated HTTPS endpoint. Prior to this users required having access to AWS credentials which we don't want to distribute.

@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 16.32653% with 41 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.44%. Comparing base (7d9c6f4) to head (66d1f86).

Files with missing lines Patch % Lines
snowexsql/lambda_client.py 19.51% 33 Missing ⚠️
snowexsql/lambda_handler.py 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #209      +/-   ##
==========================================
- Coverage   60.25%   59.44%   -0.81%     
==========================================
  Files          23       23              
  Lines        1195     1218      +23     
==========================================
+ Hits          720      724       +4     
- Misses        475      494      +19     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@jomey jomey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor comments and curious thoughts

If None, uses SNOWEX_LAMBDA_URL environment variable
or default production URL.
No AWS credentials required - uses public HTTP endpoint.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Would move this description above the Args to consolidate the method description.

function_url or
os.environ.get('SNOWEX_LAMBDA_URL') or
self.DEFAULT_FUNCTION_URL
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this should be documented somewhere that there are three options to set the URL


# Validate URL
if not self.function_url or self.function_url == 'PASTE_YOUR_FUNCTION_URL_HERE':
raise ValueError(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious where does this comparison value come from?

)
adapter = HTTPAdapter(max_retries=retry_strategy)
self.session.mount("https://", adapter)
self.session.mount("http://", adapter)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why the endpoint is mounted for both http and https although the URL is configured as only https. Can we just not support http?

region: AWS region where the Lambda function is deployed
function_name: Name of the deployed Lambda function
function_url: Lambda Function URL (https://....lambda-url.us-west-2.on.aws/)
If None, uses SNOWEX_LAMBDA_URL environment variable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example URL shows a trailing / although it is later removed in the method logic block. Think this example should not show one to start with a proper formed URL

self.function_url,
json=payload,
headers={'Content-Type': 'application/json'},
timeout=30 # 30 second timeout
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: I like to have numbers like this as class constants. Then you can omit the comment when the variable is descriptive.

f"1. The Function URL is correct\n"
f"2. You have internet connectivity\n"
f"3. The Lambda function is deployed and active\n\n"
f"Connection error: {str(e)}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting myself into the shoes of an end-user - Is this a helpful message? For instance, how much power does one have over the construction of the URL? Can one influence whether this function is properly deployed?

"SQLAlchemy <3.0",
"boto3 <2.0",
"requests >=2.31.0",
"urllib3 >=2.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these also need to be restricted to <3 in case a major version comes out with breaking changes?

There are two ways to access SnowEx data through this library:

1. **Direct Database Access** (requires database credentials)
2. **Lambda Client** (requires AWS credentials for serverless access)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this now say “no credentials” with the function URL?

)
print(df.head())
Lambda Client (Serverless Access)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we help the user out here and indicate this as the preferred one?
Could be just added to the parenthesis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants