def fetch_from_cursor( self, cursor: duckdb.DuckDBPyConnection, schema: sch.Schema, ): df = cursor.cursor.fetch_df() return schema.apply_to(df)
def fetch_from_cursor(self, cursor, schema: sch.Schema) -> pd.DataFrame: df = pd.DataFrame.from_records( cursor, columns=cursor.keys(), coerce_float=True, ) df = schema.apply_to(df) if len(df) and geospatial_supported: return self._to_geodataframe(df, schema) return df
def create_table( self, table_name: str, obj: dd.DataFrame = None, schema: sch.Schema = None, ): """Create a table.""" if obj is not None: df = obj elif schema is not None: dtypes = ibis_schema_to_dask(schema) df = schema.apply_to( dd.from_pandas( pd.DataFrame(columns=list(map(toolz.first, dtypes))), npartitions=1, )) else: raise com.IbisError('Must pass expr or schema') self.dictionary[table_name] = df