type
stringclasses 5
values | name
stringlengths 1
55
| qualified_name
stringlengths 5
143
| docstring
stringlengths 0
3.59k
⌀ | filepath
stringclasses 180
values | is_public
bool 2
classes | is_private
bool 2
classes | line_start
float64 0
1.54k
⌀ | line_end
float64 0
1.56k
⌀ | annotation
stringclasses 8
values | returns
stringclasses 236
values | parameters
listlengths 0
74
⌀ | parent_class
stringclasses 298
values | value
stringclasses 112
values | bases
listlengths 0
3
⌀ | api_element_summary
stringlengths 199
23k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
class
|
SemanticConfig
|
fenic.api.session.config.SemanticConfig
|
Configuration for semantic language and embedding models.
This class defines the configuration for both language models and optional
embedding models used in semantic operations. It ensures that all configured
models are valid and supported by their respective providers.
Attributes:
language_models: Mapping of model aliases to language model configurations.
default_language_model: The alias of the default language model to use for semantic operations. Not required
if only one language model is configured.
embedding_models: Optional mapping of model aliases to embedding model configurations.
default_embedding_model: The alias of the default embedding model to use for semantic operations.
Note:
The embedding model is optional and only required for operations that
need semantic search or embedding capabilities.
Example:
Configuring semantic models with a single language model:
```python
config = SemanticConfig(
language_models={
"gpt4": OpenAILanguageModel(
model_name="gpt-4.1-nano",
rpm=100,
tpm=100
)
}
)
```
Configuring semantic models with multiple language models and an embedding model:
```python
config = SemanticConfig(
language_models={
"gpt4": OpenAILanguageModel(
model_name="gpt-4.1-nano",
rpm=100,
tpm=100
),
"claude": AnthropicLanguageModel(
model_name="claude-3-5-haiku-latest",
rpm=100,
input_tpm=100,
output_tpm=100
),
"gemini": GoogleDeveloperLanguageModel(
model_name="gemini-2.0-flash",
rpm=100,
tpm=1000
)
},
default_language_model="gpt4",
embedding_models={
"openai_embeddings": OpenAIEmbeddingModel(
model_name="text-embedding-3-small",
rpm=100,
tpm=100
)
},
default_embedding_model="openai_embeddings"
)
```
Configuring models with profiles:
```python
config = SemanticConfig(
language_models={
"gpt4": OpenAILanguageModel(
model_name="gpt-4o-mini",
rpm=100,
tpm=100,
profiles={
"fast": OpenAILanguageModel.Profile(reasoning_effort="low"),
"thorough": OpenAILanguageModel.Profile(reasoning_effort="high")
},
default_profile="fast"
),
"claude": AnthropicLanguageModel(
model_name="claude-3-5-haiku-latest",
rpm=100,
input_tpm=100,
output_tpm=100,
profiles={
"fast": AnthropicLanguageModel.Profile(thinking_token_budget=1024),
"thorough": AnthropicLanguageModel.Profile(thinking_token_budget=4096)
},
default_profile="fast"
)
},
default_language_model="gpt4"
)
```
|
site-packages/fenic/api/session/config.py
| true | false | 713 | 937 | null | null | null | null | null |
[
"BaseModel"
] |
Type: class
Member Name: SemanticConfig
Qualified Name: fenic.api.session.config.SemanticConfig
Docstring: Configuration for semantic language and embedding models.
This class defines the configuration for both language models and optional
embedding models used in semantic operations. It ensures that all configured
models are valid and supported by their respective providers.
Attributes:
language_models: Mapping of model aliases to language model configurations.
default_language_model: The alias of the default language model to use for semantic operations. Not required
if only one language model is configured.
embedding_models: Optional mapping of model aliases to embedding model configurations.
default_embedding_model: The alias of the default embedding model to use for semantic operations.
Note:
The embedding model is optional and only required for operations that
need semantic search or embedding capabilities.
Example:
Configuring semantic models with a single language model:
```python
config = SemanticConfig(
language_models={
"gpt4": OpenAILanguageModel(
model_name="gpt-4.1-nano",
rpm=100,
tpm=100
)
}
)
```
Configuring semantic models with multiple language models and an embedding model:
```python
config = SemanticConfig(
language_models={
"gpt4": OpenAILanguageModel(
model_name="gpt-4.1-nano",
rpm=100,
tpm=100
),
"claude": AnthropicLanguageModel(
model_name="claude-3-5-haiku-latest",
rpm=100,
input_tpm=100,
output_tpm=100
),
"gemini": GoogleDeveloperLanguageModel(
model_name="gemini-2.0-flash",
rpm=100,
tpm=1000
)
},
default_language_model="gpt4",
embedding_models={
"openai_embeddings": OpenAIEmbeddingModel(
model_name="text-embedding-3-small",
rpm=100,
tpm=100
)
},
default_embedding_model="openai_embeddings"
)
```
Configuring models with profiles:
```python
config = SemanticConfig(
language_models={
"gpt4": OpenAILanguageModel(
model_name="gpt-4o-mini",
rpm=100,
tpm=100,
profiles={
"fast": OpenAILanguageModel.Profile(reasoning_effort="low"),
"thorough": OpenAILanguageModel.Profile(reasoning_effort="high")
},
default_profile="fast"
),
"claude": AnthropicLanguageModel(
model_name="claude-3-5-haiku-latest",
rpm=100,
input_tpm=100,
output_tpm=100,
profiles={
"fast": AnthropicLanguageModel.Profile(thinking_token_budget=1024),
"thorough": AnthropicLanguageModel.Profile(thinking_token_budget=4096)
},
default_profile="fast"
)
},
default_language_model="gpt4"
)
```
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: none
Returns: none
Parent Class: none
|
method
|
model_post_init
|
fenic.api.session.config.SemanticConfig.model_post_init
|
Post initialization hook to set defaults.
This hook runs after the model is initialized and validated.
It sets the default language and embedding models if they are not set
and there is only one model available.
|
site-packages/fenic/api/session/config.py
| true | false | 816 | 847 | null |
None
|
[
"self",
"__context"
] |
SemanticConfig
| null | null |
Type: method
Member Name: model_post_init
Qualified Name: fenic.api.session.config.SemanticConfig.model_post_init
Docstring: Post initialization hook to set defaults.
This hook runs after the model is initialized and validated.
It sets the default language and embedding models if they are not set
and there is only one model available.
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: ["self", "__context"]
Returns: None
Parent Class: SemanticConfig
|
method
|
validate_models
|
fenic.api.session.config.SemanticConfig.validate_models
|
Validates that the selected models are supported by the system.
This validator checks that both the language model and embedding model (if provided)
are valid and supported by their respective providers.
Returns:
The validated SemanticConfig instance.
Raises:
ConfigurationError: If any of the models are not supported.
|
site-packages/fenic/api/session/config.py
| true | false | 849 | 937 | null |
SemanticConfig
|
[
"self"
] |
SemanticConfig
| null | null |
Type: method
Member Name: validate_models
Qualified Name: fenic.api.session.config.SemanticConfig.validate_models
Docstring: Validates that the selected models are supported by the system.
This validator checks that both the language model and embedding model (if provided)
are valid and supported by their respective providers.
Returns:
The validated SemanticConfig instance.
Raises:
ConfigurationError: If any of the models are not supported.
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: ["self"]
Returns: SemanticConfig
Parent Class: SemanticConfig
|
class
|
CloudExecutorSize
|
fenic.api.session.config.CloudExecutorSize
|
Enum defining available cloud executor sizes.
This enum represents the different size options available for cloud-based
execution environments.
Attributes:
SMALL: Small instance size.
MEDIUM: Medium instance size.
LARGE: Large instance size.
XLARGE: Extra large instance size.
|
site-packages/fenic/api/session/config.py
| true | false | 940 | 955 | null | null | null | null | null |
[
"str",
"Enum"
] |
Type: class
Member Name: CloudExecutorSize
Qualified Name: fenic.api.session.config.CloudExecutorSize
Docstring: Enum defining available cloud executor sizes.
This enum represents the different size options available for cloud-based
execution environments.
Attributes:
SMALL: Small instance size.
MEDIUM: Medium instance size.
LARGE: Large instance size.
XLARGE: Extra large instance size.
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: none
Returns: none
Parent Class: none
|
class
|
CloudConfig
|
fenic.api.session.config.CloudConfig
|
Configuration for cloud-based execution.
This class defines settings for running operations in a cloud environment,
allowing for scalable and distributed processing of language model operations.
Attributes:
size: Size of the cloud executor instance.
If None, the default size will be used.
Example:
Configuring cloud execution with a specific size:
```python
config = CloudConfig(size=CloudExecutorSize.MEDIUM)
```
Using default cloud configuration:
```python
config = CloudConfig()
```
|
site-packages/fenic/api/session/config.py
| true | false | 958 | 981 | null | null | null | null | null |
[
"BaseModel"
] |
Type: class
Member Name: CloudConfig
Qualified Name: fenic.api.session.config.CloudConfig
Docstring: Configuration for cloud-based execution.
This class defines settings for running operations in a cloud environment,
allowing for scalable and distributed processing of language model operations.
Attributes:
size: Size of the cloud executor instance.
If None, the default size will be used.
Example:
Configuring cloud execution with a specific size:
```python
config = CloudConfig(size=CloudExecutorSize.MEDIUM)
```
Using default cloud configuration:
```python
config = CloudConfig()
```
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: none
Returns: none
Parent Class: none
|
class
|
SessionConfig
|
fenic.api.session.config.SessionConfig
|
Configuration for a user session.
This class defines the complete configuration for a user session, including
application settings, model configurations, and optional cloud settings.
It serves as the central configuration object for all language model operations.
Attributes:
app_name: Name of the application using this session. Defaults to "default_app".
db_path: Optional path to a local database file for persistent storage.
semantic: Configuration for semantic models (optional).
cloud: Optional configuration for cloud execution.
Note:
The semantic configuration is optional. When not provided, only non-semantic operations
are available. The cloud configuration is optional and only needed for
distributed processing.
Example:
Configuring a basic session with a single language model:
```python
config = SessionConfig(
app_name="my_app",
semantic=SemanticConfig(
language_models={
"gpt4": OpenAILanguageModel(
model_name="gpt-4.1-nano",
rpm=100,
tpm=100
)
}
)
)
```
Configuring a session with multiple models and cloud execution:
```python
config = SessionConfig(
app_name="production_app",
db_path=Path("/path/to/database.db"),
semantic=SemanticConfig(
language_models={
"gpt4": OpenAILanguageModel(
model_name="gpt-4.1-nano",
rpm=100,
tpm=100
),
"claude": AnthropicLanguageModel(
model_name="claude-3-5-haiku-latest",
rpm=100,
input_tpm=100,
output_tpm=100
)
},
default_language_model="gpt4",
embedding_models={
"openai_embeddings": OpenAIEmbeddingModel(
model_name="text-embedding-3-small",
rpm=100,
tpm=100
)
},
default_embedding_model="openai_embeddings"
),
cloud=CloudConfig(size=CloudExecutorSize.MEDIUM)
)
```
|
site-packages/fenic/api/session/config.py
| true | false | 984 | 1,171 | null | null | null | null | null |
[
"BaseModel"
] |
Type: class
Member Name: SessionConfig
Qualified Name: fenic.api.session.config.SessionConfig
Docstring: Configuration for a user session.
This class defines the complete configuration for a user session, including
application settings, model configurations, and optional cloud settings.
It serves as the central configuration object for all language model operations.
Attributes:
app_name: Name of the application using this session. Defaults to "default_app".
db_path: Optional path to a local database file for persistent storage.
semantic: Configuration for semantic models (optional).
cloud: Optional configuration for cloud execution.
Note:
The semantic configuration is optional. When not provided, only non-semantic operations
are available. The cloud configuration is optional and only needed for
distributed processing.
Example:
Configuring a basic session with a single language model:
```python
config = SessionConfig(
app_name="my_app",
semantic=SemanticConfig(
language_models={
"gpt4": OpenAILanguageModel(
model_name="gpt-4.1-nano",
rpm=100,
tpm=100
)
}
)
)
```
Configuring a session with multiple models and cloud execution:
```python
config = SessionConfig(
app_name="production_app",
db_path=Path("/path/to/database.db"),
semantic=SemanticConfig(
language_models={
"gpt4": OpenAILanguageModel(
model_name="gpt-4.1-nano",
rpm=100,
tpm=100
),
"claude": AnthropicLanguageModel(
model_name="claude-3-5-haiku-latest",
rpm=100,
input_tpm=100,
output_tpm=100
)
},
default_language_model="gpt4",
embedding_models={
"openai_embeddings": OpenAIEmbeddingModel(
model_name="text-embedding-3-small",
rpm=100,
tpm=100
)
},
default_embedding_model="openai_embeddings"
),
cloud=CloudConfig(size=CloudExecutorSize.MEDIUM)
)
```
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: none
Returns: none
Parent Class: none
|
method
|
to_json
|
fenic.api.session.config.SessionConfig.to_json
|
Export the session config to a JSON string.
|
site-packages/fenic/api/session/config.py
| true | false | 1,059 | 1,061 | null |
str
|
[
"self"
] |
SessionConfig
| null | null |
Type: method
Member Name: to_json
Qualified Name: fenic.api.session.config.SessionConfig.to_json
Docstring: Export the session config to a JSON string.
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: ["self"]
Returns: str
Parent Class: SessionConfig
|
method
|
_to_resolved_config
|
fenic.api.session.config.SessionConfig._to_resolved_config
| null |
site-packages/fenic/api/session/config.py
| false | true | 1,063 | 1,171 | null |
ResolvedSessionConfig
|
[
"self"
] |
SessionConfig
| null | null |
Type: method
Member Name: _to_resolved_config
Qualified Name: fenic.api.session.config.SessionConfig._to_resolved_config
Docstring: none
Value: none
Annotation: none
is Public? : false
is Private? : true
Parameters: ["self"]
Returns: ResolvedSessionConfig
Parent Class: SessionConfig
|
function
|
_validate_language_profile
|
fenic.api.session.config._validate_language_profile
|
Validate the language profile against the language model.
|
site-packages/fenic/api/session/config.py
| false | true | 1,173 | 1,182 | null |
None
|
[
"language_model",
"model_alias",
"completion_model_params",
"profile",
"profile_alias"
] | null | null | null |
Type: function
Member Name: _validate_language_profile
Qualified Name: fenic.api.session.config._validate_language_profile
Docstring: Validate the language profile against the language model.
Value: none
Annotation: none
is Public? : false
is Private? : true
Parameters: ["language_model", "model_alias", "completion_model_params", "profile", "profile_alias"]
Returns: None
Parent Class: none
|
function
|
_validate_embedding_profile
|
fenic.api.session.config._validate_embedding_profile
|
Validate Embedding profile against embedding model parameters.
|
site-packages/fenic/api/session/config.py
| false | true | 1,184 | 1,195 | null | null |
[
"embedding_model_parameters",
"model_alias",
"profile_alias",
"profile"
] | null | null | null |
Type: function
Member Name: _validate_embedding_profile
Qualified Name: fenic.api.session.config._validate_embedding_profile
Docstring: Validate Embedding profile against embedding model parameters.
Value: none
Annotation: none
is Public? : false
is Private? : true
Parameters: ["embedding_model_parameters", "model_alias", "profile_alias", "profile"]
Returns: none
Parent Class: none
|
function
|
_get_model_provider_for_model_config
|
fenic.api.session.config._get_model_provider_for_model_config
|
Determine the ModelProvider for the given model configuration.
|
site-packages/fenic/api/session/config.py
| false | true | 1,197 | 1,210 | null |
ModelProvider
|
[
"model_config"
] | null | null | null |
Type: function
Member Name: _get_model_provider_for_model_config
Qualified Name: fenic.api.session.config._get_model_provider_for_model_config
Docstring: Determine the ModelProvider for the given model configuration.
Value: none
Annotation: none
is Public? : false
is Private? : true
Parameters: ["model_config"]
Returns: ModelProvider
Parent Class: none
|
module
|
session
|
fenic.api.session.session
|
Main session class for interacting with the DataFrame API.
|
site-packages/fenic/api/session/session.py
| true | false | null | null | null | null | null | null | null | null |
Type: module
Member Name: session
Qualified Name: fenic.api.session.session
Docstring: Main session class for interacting with the DataFrame API.
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: none
Returns: none
Parent Class: none
|
class
|
Session
|
fenic.api.session.session.Session
|
The entry point to programming with the DataFrame API. Similar to PySpark's SparkSession.
Example: Create a session with default configuration
```python
session = Session.get_or_create(SessionConfig(app_name="my_app"))
```
Example: Create a session with cloud configuration
```python
config = SessionConfig(
app_name="my_app",
cloud=True,
api_key="your_api_key"
)
session = Session.get_or_create(config)
```
|
site-packages/fenic/api/session/session.py
| true | false | 31 | 342 | null | null | null | null | null |
[] |
Type: class
Member Name: Session
Qualified Name: fenic.api.session.session.Session
Docstring: The entry point to programming with the DataFrame API. Similar to PySpark's SparkSession.
Example: Create a session with default configuration
```python
session = Session.get_or_create(SessionConfig(app_name="my_app"))
```
Example: Create a session with cloud configuration
```python
config = SessionConfig(
app_name="my_app",
cloud=True,
api_key="your_api_key"
)
session = Session.get_or_create(config)
```
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: none
Returns: none
Parent Class: none
|
method
|
__new__
|
fenic.api.session.session.Session.__new__
|
Create a new Session instance.
|
site-packages/fenic/api/session/session.py
| true | false | 54 | 60 | null | null |
[
"cls"
] |
Session
| null | null |
Type: method
Member Name: __new__
Qualified Name: fenic.api.session.session.Session.__new__
Docstring: Create a new Session instance.
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: ["cls"]
Returns: none
Parent Class: Session
|
method
|
get_or_create
|
fenic.api.session.session.Session.get_or_create
|
Gets an existing Session or creates a new one with the configured settings.
Returns:
A Session instance configured with the provided settings
|
site-packages/fenic/api/session/session.py
| true | false | 62 | 89 | null |
Session
|
[
"cls",
"config"
] |
Session
| null | null |
Type: method
Member Name: get_or_create
Qualified Name: fenic.api.session.session.Session.get_or_create
Docstring: Gets an existing Session or creates a new one with the configured settings.
Returns:
A Session instance configured with the provided settings
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: ["cls", "config"]
Returns: Session
Parent Class: Session
|
method
|
_create_local_session
|
fenic.api.session.session.Session._create_local_session
|
Get or create a local session.
|
site-packages/fenic/api/session/session.py
| false | true | 91 | 101 | null |
Session
|
[
"cls",
"session_state"
] |
Session
| null | null |
Type: method
Member Name: _create_local_session
Qualified Name: fenic.api.session.session.Session._create_local_session
Docstring: Get or create a local session.
Value: none
Annotation: none
is Public? : false
is Private? : true
Parameters: ["cls", "session_state"]
Returns: Session
Parent Class: Session
|
method
|
_create_cloud_session
|
fenic.api.session.session.Session._create_cloud_session
|
Create a cloud session.
|
site-packages/fenic/api/session/session.py
| false | true | 103 | 113 | null |
Session
|
[
"cls",
"session_state"
] |
Session
| null | null |
Type: method
Member Name: _create_cloud_session
Qualified Name: fenic.api.session.session.Session._create_cloud_session
Docstring: Create a cloud session.
Value: none
Annotation: none
is Public? : false
is Private? : true
Parameters: ["cls", "session_state"]
Returns: Session
Parent Class: Session
|
method
|
create_dataframe
|
fenic.api.session.session.Session.create_dataframe
|
Create a DataFrame from a variety of Python-native data formats.
Args:
data: Input data. Must be one of:
- Polars DataFrame
- Pandas DataFrame
- dict of column_name -> list of values
- list of dicts (each dict representing a row)
- pyarrow Table
Returns:
A new DataFrame instance
Raises:
ValueError: If the input format is unsupported or inconsistent with provided column names.
Example: Create from Polars DataFrame
```python
import polars as pl
df = pl.DataFrame({"col1": [1, 2], "col2": ["a", "b"]})
session.create_dataframe(df)
```
Example: Create from Pandas DataFrame
```python
import pandas as pd
df = pd.DataFrame({"col1": [1, 2], "col2": ["a", "b"]})
session.create_dataframe(df)
```
Example: Create from dictionary
```python
session.create_dataframe({"col1": [1, 2], "col2": ["a", "b"]})
```
Example: Create from list of dictionaries
```python
session.create_dataframe([
{"col1": 1, "col2": "a"},
{"col1": 2, "col2": "b"}
])
```
Example: Create from pyarrow Table
```python
import pyarrow as pa
table = pa.Table.from_pydict({"col1": [1, 2], "col2": ["a", "b"]})
session.create_dataframe(table)
```
|
site-packages/fenic/api/session/session.py
| true | false | 132 | 220 | null |
DataFrame
|
[
"self",
"data"
] |
Session
| null | null |
Type: method
Member Name: create_dataframe
Qualified Name: fenic.api.session.session.Session.create_dataframe
Docstring: Create a DataFrame from a variety of Python-native data formats.
Args:
data: Input data. Must be one of:
- Polars DataFrame
- Pandas DataFrame
- dict of column_name -> list of values
- list of dicts (each dict representing a row)
- pyarrow Table
Returns:
A new DataFrame instance
Raises:
ValueError: If the input format is unsupported or inconsistent with provided column names.
Example: Create from Polars DataFrame
```python
import polars as pl
df = pl.DataFrame({"col1": [1, 2], "col2": ["a", "b"]})
session.create_dataframe(df)
```
Example: Create from Pandas DataFrame
```python
import pandas as pd
df = pd.DataFrame({"col1": [1, 2], "col2": ["a", "b"]})
session.create_dataframe(df)
```
Example: Create from dictionary
```python
session.create_dataframe({"col1": [1, 2], "col2": ["a", "b"]})
```
Example: Create from list of dictionaries
```python
session.create_dataframe([
{"col1": 1, "col2": "a"},
{"col1": 2, "col2": "b"}
])
```
Example: Create from pyarrow Table
```python
import pyarrow as pa
table = pa.Table.from_pydict({"col1": [1, 2], "col2": ["a", "b"]})
session.create_dataframe(table)
```
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: ["self", "data"]
Returns: DataFrame
Parent Class: Session
|
method
|
table
|
fenic.api.session.session.Session.table
|
Returns the specified table as a DataFrame.
Args:
table_name: Name of the table
Returns:
Table as a DataFrame
Raises:
ValueError: If the table does not exist
Example: Load an existing table
```python
df = session.table("my_table")
```
|
site-packages/fenic/api/session/session.py
| true | false | 222 | 244 | null |
DataFrame
|
[
"self",
"table_name"
] |
Session
| null | null |
Type: method
Member Name: table
Qualified Name: fenic.api.session.session.Session.table
Docstring: Returns the specified table as a DataFrame.
Args:
table_name: Name of the table
Returns:
Table as a DataFrame
Raises:
ValueError: If the table does not exist
Example: Load an existing table
```python
df = session.table("my_table")
```
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: ["self", "table_name"]
Returns: DataFrame
Parent Class: Session
|
method
|
view
|
fenic.api.session.session.Session.view
|
Returns the specified view as a DataFrame.
Args:
view_name: Name of the view
Returns:
DataFrame: Dataframe with the given view
|
site-packages/fenic/api/session/session.py
| true | false | 246 | 263 | null |
DataFrame
|
[
"self",
"view_name"
] |
Session
| null | null |
Type: method
Member Name: view
Qualified Name: fenic.api.session.session.Session.view
Docstring: Returns the specified view as a DataFrame.
Args:
view_name: Name of the view
Returns:
DataFrame: Dataframe with the given view
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: ["self", "view_name"]
Returns: DataFrame
Parent Class: Session
|
method
|
sql
|
fenic.api.session.session.Session.sql
|
Execute a read-only SQL query against one or more DataFrames using named placeholders.
This allows you to execute ad hoc SQL queries using familiar syntax when it's more convenient than the DataFrame API.
Placeholders in the SQL string (e.g. `{df}`) should correspond to keyword arguments (e.g. `df=my_dataframe`).
For supported SQL syntax and functions, refer to the DuckDB SQL documentation:
https://duckdb.org/docs/sql/introduction.
Args:
query: A SQL query string with placeholders like `{df}`
**tables: Keyword arguments mapping placeholder names to DataFrames
Returns:
A lazy DataFrame representing the result of the SQL query
Raises:
ValidationError: If a placeholder is used in the query but not passed
as a keyword argument
Example: Simple join between two DataFrames
```python
df1 = session.create_dataframe({"id": [1, 2]})
df2 = session.create_dataframe({"id": [2, 3]})
result = session.sql(
"SELECT * FROM {df1} JOIN {df2} USING (id)",
df1=df1,
df2=df2
)
```
Example: Complex query with multiple DataFrames
```python
users = session.create_dataframe({"user_id": [1, 2], "name": ["Alice", "Bob"]})
orders = session.create_dataframe({"order_id": [1, 2], "user_id": [1, 2]})
products = session.create_dataframe({"product_id": [1, 2], "name": ["Widget", "Gadget"]})
result = session.sql("""
SELECT u.name, p.name as product
FROM {users} u
JOIN {orders} o ON u.user_id = o.user_id
JOIN {products} p ON o.product_id = p.product_id
""", users=users, orders=orders, products=products)
```
|
site-packages/fenic/api/session/session.py
| true | false | 265 | 335 | null |
DataFrame
|
[
"self",
"query",
"tables"
] |
Session
| null | null |
Type: method
Member Name: sql
Qualified Name: fenic.api.session.session.Session.sql
Docstring: Execute a read-only SQL query against one or more DataFrames using named placeholders.
This allows you to execute ad hoc SQL queries using familiar syntax when it's more convenient than the DataFrame API.
Placeholders in the SQL string (e.g. `{df}`) should correspond to keyword arguments (e.g. `df=my_dataframe`).
For supported SQL syntax and functions, refer to the DuckDB SQL documentation:
https://duckdb.org/docs/sql/introduction.
Args:
query: A SQL query string with placeholders like `{df}`
**tables: Keyword arguments mapping placeholder names to DataFrames
Returns:
A lazy DataFrame representing the result of the SQL query
Raises:
ValidationError: If a placeholder is used in the query but not passed
as a keyword argument
Example: Simple join between two DataFrames
```python
df1 = session.create_dataframe({"id": [1, 2]})
df2 = session.create_dataframe({"id": [2, 3]})
result = session.sql(
"SELECT * FROM {df1} JOIN {df2} USING (id)",
df1=df1,
df2=df2
)
```
Example: Complex query with multiple DataFrames
```python
users = session.create_dataframe({"user_id": [1, 2], "name": ["Alice", "Bob"]})
orders = session.create_dataframe({"order_id": [1, 2], "user_id": [1, 2]})
products = session.create_dataframe({"product_id": [1, 2], "name": ["Widget", "Gadget"]})
result = session.sql("""
SELECT u.name, p.name as product
FROM {users} u
JOIN {orders} o ON u.user_id = o.user_id
JOIN {products} p ON o.product_id = p.product_id
""", users=users, orders=orders, products=products)
```
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: ["self", "query", "tables"]
Returns: DataFrame
Parent Class: Session
|
method
|
stop
|
fenic.api.session.session.Session.stop
|
Stops the session and closes all connections.
A summary of your session's metrics will print once you stop your session.
|
site-packages/fenic/api/session/session.py
| true | false | 337 | 342 | null | null |
[
"self"
] |
Session
| null | null |
Type: method
Member Name: stop
Qualified Name: fenic.api.session.session.Session.stop
Docstring: Stops the session and closes all connections.
A summary of your session's metrics will print once you stop your session.
Value: none
Annotation: none
is Public? : true
is Private? : false
Parameters: ["self"]
Returns: none
Parent Class: Session
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.