Columnar export#

agensgraph.columnar. Each function imports its library only when called. See DataFrames and Arrow.

Functions#

agensgraph.columnar.to_arrow(
source: Any,
keys: Sequence[str] | None = None,
*,
size: int | None = None,
oids: Sequence[int] = (),
layout: Layout = Layout(),
schema: Any = None,
) → Any#

A pyarrow.Table. source is a Result, a cursor, or rows with keys.

agensgraph.columnar.to_pandas(
source: Any,
keys: Sequence[str] | None = None,
*,
dtypes: 'arrow' | 'numpy' = 'arrow',
size: int | None = None,
oids: Sequence[int] = (),
layout: Layout = Layout(),
schema: Any = None,
) → Any#

A pandas.DataFrame, with Arrow types unless dtypes="numpy".

agensgraph.columnar.to_polars(
source: Any,
keys: Sequence[str] | None = None,
*,
size: int | None = None,
oids: Sequence[int] = (),
layout: Layout = Layout(),
schema: Any = None,
) → Any#

A polars.DataFrame.

agensgraph.columnar.batches(
source: Any,
keys: Sequence[str] | None = None,
*,
size: int | None = 8192,
oids: Sequence[int] = (),
layout: Layout = Layout(),
schema: Any = None,
) → Iterator[Any]#

pyarrow.RecordBatches of size rows; the first settles the schema.

agensgraph.columnar.reader(
source: Any,
keys: Sequence[str] | None = None,
*,
size: int | None = 8192,
oids: Sequence[int] = (),
layout: Layout = Layout(),
schema: Any = None,
) → Any#

A pyarrow.RecordBatchReader over the same.

agensgraph.columnar.columns(records: Sequence[Sequence[Any]], keys: Sequence[str]) → dict[str, list[Any]]#

A dict of Python lists, without a library.

agensgraph.columnar.async_to_arrow(
source: Any,
keys: Sequence[str] | None = None,
*,
size: int | None = None,
oids: Sequence[int] = (),
layout: Layout = Layout(),
schema: Any = None,
) → Any#

to_arrow for an awaiting source.

agensgraph.columnar.async_to_pandas(
source: Any,
keys: Sequence[str] | None = None,
*,
dtypes: 'arrow' | 'numpy' = 'arrow',
size: int | None = None,
oids: Sequence[int] = (),
layout: Layout = Layout(),
schema: Any = None,
) → Any#

to_pandas for an awaiting source.

agensgraph.columnar.async_to_polars(
source: Any,
keys: Sequence[str] | None = None,
*,
size: int | None = None,
oids: Sequence[int] = (),
layout: Layout = Layout(),
schema: Any = None,
) → Any#

to_polars for an awaiting source.

agensgraph.columnar.async_batches(
source: Any,
keys: Sequence[str] | None = None,
*,
size: int | None = 8192,
oids: Sequence[int] = (),
layout: Layout = Layout(),
schema: Any = None,
) → AsyncIterator[Any]#

batches for an awaiting source.

Layout#

class agensgraph.columnar.Layout(
elements: 'struct' | 'columns' = 'struct',
identity: 'packed' | 'text' = 'packed',
properties: Any = 'json',
labels: 'dictionary' | 'text' = 'dictionary',
vectors: 'fixed' | 'list' = 'fixed',
sparse: 'parts' | 'text' | 'dense' = 'parts',
)#

How graph values become columns.

elements: 'struct' | 'columns'#

struct, or columns to spread an element over several

identity: 'packed' | 'text'#

packed integers or text

properties: Any#

json text, skip, or a pyarrow struct type of named properties

labels: 'dictionary' | 'text'#

dictionary encoded or text

vectors: 'fixed' | 'list'#

fixed size lists or variable lists

sparse: 'parts' | 'text' | 'dense'#

parts, text or dense

agensgraph.columnar.CHUNK = 8192#

The default chunk size.