(
self, name: str, config: JSONConfig, duckdb_conn: duckdb.DuckDBPyConnection
)
| 168 | |
| 169 | class 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() |
nothing calls this directly
no test coverage detected