A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.geldata.com/reference/using/python/api/types below:

Data types - Python - Using Gel | Reference

gel-python automatically converts Gel types to the corresponding Python types and vice versa.

The table below shows the correspondence between Gel and Python types.

Inexact single-precision float values may have a different representation when decoded into a Python float. This is inherent to the implementation of limited-precision floating point types. If you need the decimal representation to match, cast the expression to float64 or decimal in your query.

This is list since version 1.0.

An immutable representation of an object instance returned from a query.

gel.Object instances are dataclass-compatible since version 1.0, for example, dataclasses.is_dataclass() will return True, and dataclasses.asdict() will work on gel.Object instances.

gel.Object.__hash__ is just object.__hash__ in version 1.0. Similarly, == is equivalent to the is operator comparing gel.Object instances, and <, <=, >, >= are not allowed on gel.Object instances.

The value of an object property or a link can be accessed through a corresponding attribute:

>>> 
client = gel.create_client()
>>> 
... 
... 
... 
r = client.query_single('''
    SELECT schema::ObjectType {name}
    FILTER .name = 'std::Object'
    LIMIT 1''')
Object{name := 'std::Object'}

Return a gel.Link or a gel.LinkSet instance representing the instance(s) of link linkname associated with obj.

Example:

>>> 
client = gel.create_client()
>>> 
... 
... 
... 
... 
r = client.query_single('''
    SELECT schema::Property {name, annotations: {name, @value}}
    FILTER .name = 'listen_port'
           AND .source.name = 'cfg::Config'
    LIMIT 1''')
Object {
    name: 'listen_port',
    annotations: {
        Object {
            name: 'cfg::system',
            @value: 'true'
        }
    }
}
LinkSet(name='annotations')
>>> 
l = list(r['annotations])[0]

An immutable representation of an object link.

Links are created when gel.Object is accessed via a [] operator. Using Link objects explicitly is useful for accessing link properties.

An immutable representation of a set of Links.

LinkSets are created when a multi link on gel.Object is accessed via a [] operator.

This is tuple since version 1.0.

An immutable value representing a Gel named tuple value.

gel.NamedTuple is a subclass of tuple and is duck-type compatible with collections.namedtuple since version 1.0.

Instances of gel.NamedTuple generally behave similarly to namedtuple:

>>> 
client = gel.create_client()
>>> 
r = client.query_single('''SELECT (a := 1, b := 'a', c := [3])''')
(a := 1, b := 'a', c := [3])

This is list since version 1.0.

An immutable value representing a Gel cal::relative_duration value.

>>> 
client = gel.create_client()
>>> 
r = client.query_single('''SELECT <cal::relative_duration>"1 year 2 days 3 seconds"''')
<gel.RelativeDuration "P1Y2DT3S">

An immutable value representing a Gel cal::date_duration value.

>>> 
client = gel.create_client()
>>> 
r = client.query_single('''SELECT <cal::date_duration>"1 year 2 days"''')
<gel.DateDuration "P1Y2D">

An immutable value representing a Gel enum value.

Since version 1.0, gel.EnumValue is a subclass of enum.Enum. Actual enum values are instances of ad-hoc enum classes created by the codecs to represent the actual members defined in your Gel schema.

>>> 
client = gel.create_client()
>>> 
r = client.query_single("""SELECT <Color>'red'""")

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4