MCPcopy
hub / github.com/StructuredLabs/preswald / __init__

Method __init__

preswald/engine/managers/data.py:170–176  ·  view source on GitHub ↗
(
        self, name: str, config: JSONConfig, duckdb_conn: duckdb.DuckDBPyConnection
    )

Source from the content-addressed store, hash-verified

168
169class JSONSource(DataSource):
170 def __init__(
171 self, name: str, config: JSONConfig, duckdb_conn: duckdb.DuckDBPyConnection
172 ):
173 super().__init__(name, duckdb_conn)
174 df = _load_json_source(config.__dict__) # noqa: F841
175 self._table_name = f"json_{uuid.uuid4().hex[:8]}"
176 self._duckdb.execute(f"CREATE TABLE {self._table_name} AS SELECT * FROM df")
177
178 def query(self, sql: str) -> pd.DataFrame:
179 return self._duckdb.execute(sql.replace(self.name, self._table_name)).df()

Callers

nothing calls this directly

Calls 3

_load_json_sourceFunction · 0.85
executeMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected