コード例 #1
0
ファイル: __init__.py プロジェクト: ibis-project/ibis
 def fetch_from_cursor(
     self,
     cursor: duckdb.DuckDBPyConnection,
     schema: sch.Schema,
 ):
     df = cursor.cursor.fetch_df()
     return schema.apply_to(df)
コード例 #2
0
ファイル: __init__.py プロジェクト: ibis-project/ibis
 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
コード例 #3
0
ファイル: __init__.py プロジェクト: vishalbelsare/ibis
    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