Changes in 0.2#
0.2.0#
Added ability to export
hiku.query
nodes. Addedhiku.export.simple
exporter, which will export query into EDN data structureAdded debug mode for the
hiku.console
application, showing Python tracebacks if debug mode is turned onImplemented
hiku.validate.query.QueryValidator
to validate query against graph definition before it’s executionImplemented
hiku.validate.graph.GraphValidator
to validate graph definitionAdded ability to define graph links with
hiku.types.Optional
type:Link('link-to-foo', Optional[TypeRef['foo']], func, requires=None)
Added ability to query complex fields, which has a type of
Optional[Record[...]]
,Record[...]
orSequence[Record[...]]
as if they were linked edges:Edge('foo', [ Field('bar', Record[{'baz': Integer}], func), ])
Here
bar
field should be queried as it was a link to the edge:[{:link-to-foo [{:bar [:baz]}]}]
Added ability to use scalar values in the expressions. Currently only integer numbers and strings are supported:
Expr('foo', foo_subgraph, func(S.this.foo, 'scalar'))
Implemented
hiku.expr.if_some()
function in order to unpackhiku.types.Optional
type in expressionsAdded ability to pass objects, required to execute query, using bound to the query context:
@pass_context def func(ctx, fields): return [ctx['storage'][f.name] for f in fields] Root([ Field('foo', None, func), ]) engine.execute(graph, read('[:foo]'), ctx={'storage': {'foo': 1}})
Implemented new
hiku.sources.aiopg
source for using aiopg andhiku.executors.asyncio.AsyncIOExecutor
to asynchronously load data from the PostgreSQL databaseAdded ability to define function arguments using types instead of queries:
@define(Record[{'foo': Integer}]) # instead of @define('[[:foo]]') def func(arg): return arg['foo'] + 1
Backward-incompatible changes#
Changed type of
hiku.graph.Field.options
fromMapping[str, Option]
toSequence[Option]
Changed type of
hiku.graph.Link.options
fromMapping[str, Option]
toSequence[Option]
Changed type of
hiku.graph.Edge.fields
fromMapping[str, Union[Field, Link]]
toSequence[Union[Field, Link]]
Changed type of
hiku.query.Edge.fields
fromMapping[str, Union[Field, Link]]
toSequence[Union[Field, Link]]
hiku.graph.Graph
is not a subclass of thehiku.graph.Edge
anymore, all the root edges, fields and links should be defined in thehiku.graph.Root
edge. Nowhiku.graph.Graph
can contain only edgesAll
hiku.types
andhiku.typedef.types
are now subclasses oftype
, instead of being instances oftype
Renamed
hiku.types.Type
intohiku.types.GenericMeta
Renamed
hiku.types.BooleanType
intohiku.types.Boolean
Renamed
hiku.types.StringType
intohiku.types.String
Renamed
hiku.types.IntegerType
intohiku.types.Integer
Renamed
hiku.types.OptionType
intohiku.types.Optional
Renamed
hiku.types.ListType
intohiku.types.Sequence
Renamed
hiku.types.DictType
intohiku.types.Mapping
Renamed
hiku.types.RecordType
intohiku.types.Record
Renamed
hiku.types.FunctionType
intohiku.types.Callable
Removed
hiku.types.ContainerType
Removed
hiku.types.to_instance()
Moved
hiku.typedef.types.TypeRef
intohiku.types.TypeRef
Moved
hiku.typedef.types.TypeRefMeta
intohiku.types.TypeRefMeta
Replaced required keyword arguments
to_list
andedge
in thehiku.graph.Link
class by one second positional argument, which can have one of these values:TypeRef['foo']
orOptional[TypeRef['foo']]
instead ofedge='foo', to_list=False
Sequence[TypeRef['foo']]
instead ofedge='foo', to_list=True
Before:
Link('foo', func, edge='bar', requires='id', to_list=True)
Now:
Link('foo', Sequence[TypeRef['bar']], func, requires='id')
Replaced required keyword arguments
to_list
andedge
in thehiku.sources.sqlalchemy.LinkQuery
class by one second positional argument, as inhiku.graph.Link
Renamed required keyword argument and corresponding instance attribute from
doc
intodescription
in thehiku.graph.Field
,hiku.graph.Link
,hiku.graph.Edge
and in thehiku.sources.sqlalchemy.Link
classesRenamed attribute of the
hiku.typedef.kinko.TypeDoc
from__type_doc__
into__type_description__
Moved constant
hiku.engine.Nothing
to thehiku.graph.Nothing
Renamed attribute
hiku.result.Ref.storage
intohiku.result.Ref.index
Renamed attribute
hiku.result.State.idx
intohiku.result.State.index
hiku.sources.sqlalchemy.FieldsQuery
andhiku.sources.sqlalchemy.LinkQuery
now require context keys instead of “connectable” objects (SQLAlchemy’s scoped session)Moved type
hiku.typedef.types.Unknown
to thehiku.types.Unknown
Positional
type
argument inhiku.graph.Field
and inhiku.graph.Option
now is required