MCPcopy
hub / github.com/pathwaycom/pathway / schema_builder

Function schema_builder

python/pathway/schema.py:12–40  ·  view source on GitHub ↗

Allows to build schema inline, from a dictionary of column definitions. Args: columns: dictionary of column definitions. name: schema name. properties: schema properties. Returns: Schema Example: >>> import pathway as pw >>> pw.schema_builder(c

(
    columns: dict[str, ColumnDefinition],
    *,
    name: str | None = None,
    properties: SchemaProperties = SchemaProperties(),
    id_type: type = Pointer,
)

Source from the content-addressed store, hash-verified

10
11
12def schema_builder(
13 columns: dict[str, ColumnDefinition],
14 *,
15 name: str | None = None,
16 properties: SchemaProperties = SchemaProperties(),
17 id_type: type = Pointer,
18) -> type[Schema]:
19 """Allows to build schema inline, from a dictionary of column definitions.
20
21 Args:
22 columns: dictionary of column definitions.
23 name: schema name.
24 properties: schema properties.
25
26 Returns:
27 Schema
28
29 Example:
30
31 >>> import pathway as pw
32 >>> pw.schema_builder(columns={
33 ... 'key': pw.column_definition(dtype=int, primary_key=True),
34 ... 'data': pw.column_definition(dtype=int, default_value=0)
35 ... }, name="my_schema")
36 <pathway.Schema types={'key': <class 'int'>, 'data': <class 'int'>}, id_type=pathway.engine.Pointer[int]>
37 """
38 return _schema_builder(
39 columns, name=name, properties=properties, id_dtype=dt.wrap(id_type)
40 )

Callers

nothing calls this directly

Calls 3

SchemaPropertiesClass · 0.90
_schema_builderFunction · 0.90
wrapMethod · 0.80

Tested by

no test coverage detected