# get_default_session

> **Function** in `langchain_snowflake`

📖 [View in docs](https://reference.langchain.com/python/langchain-snowflake/get_default_session)

Get a default Snowflake session with smart fallback strategy.

Tries to create a session in the following priority order:
1. Key pair authentication (most secure)
2. PAT authentication (recommended for production)
3. Password authentication (development/legacy)
4. Connection string authentication

All methods read from the same SNOWFLAKE_* environment variables.

## Signature

```python
get_default_session() -> Optional[Session]
```

## Returns

`Optional[Session]`

Snowflake session or None if no valid credentials found

---

[View source on GitHub](https://github.com/langchain-ai/langchain-snowflake/blob/1a32a1c6642b6c453e9537f35afbc7da280f8679/libs/snowflake/langchain_snowflake/__init__.py#L309)