class jina.types.querylang.QueryLang(querylang=None, copy=False)[source]

Bases: object

QueryLang is one of the primitive data type in Jina.

It offers a Pythonic interface to allow users access and manipulate jina.jina_pb2.QueryLangProto object without working with Protobuf itself.

To create a QueryLang object from a BaseDriver object, simply:

from jina import QueryLang
from jina.drivers.querylang.slice import SliceQL

s = SliceQL(start=3, end=4)
ql = QueryLang(s)

One can also build a :class`QueryLang` from JSON string, bytes, dict or directly from a protobuf object.

A QueryLang object (no matter how it is constructed) can be converted to protobuf object or back to driver object by using:

# to protobuf object

# to driver object

To get the class name of the associated driver, one can use driver.

  • querylang (Optional[~QueryLangSourceType]) – the query language source to construct from, acceptable types include: jina_pb2.QueryLangProto, bytes, str, Dict, BaseDriver.

  • copy (bool) – when querylang is given as a QueryLangProto object, build a view (i.e. weak reference) from it or a deep copy from it.

property priority

Get the priority of this query language. The query language only takes effect when if it has a higher priority than the internal one with the same name

Return type


property name

Get the name of the driver that the query language attached to

Return type


property driver

Get the driver class that the query language attached to


This browses all module trees and can be costly, do not frequently call it.

Return type


property as_pb_object

Return a protobuf jina_pb2.QueryLangProto object

Return type


property as_driver_object

Return a BaseDriver object

Return type