Skip to content

Commit 00ce6f8

Browse files
committed
Added argument to specify From in query.
1 parent b9f4c71 commit 00ce6f8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cottontaildb_client/cottontaildb_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def ping(self):
343343
"""Sends a ping message to the endpoint. If method returns without exception endpoint is connected."""
344344
self._dql.Ping(Empty())
345345

346-
def query(self, schema, entity, projection, where, order=None, limit=None, skip=None):
346+
def query(self, schema, entity, projection, where, order=None, limit=None, skip=None, from_=None):
347347
"""
348348
Queries the specified entity where the provided conditions are met and applies the given projection.
349349
@@ -354,10 +354,11 @@ def query(self, schema, entity, projection, where, order=None, limit=None, skip=
354354
@param order: order by clause specifying the order of the result
355355
@param limit: maximum number of rows to return
356356
@param skip: number of rows to skip
357+
@param from_: from clause, defaults to scan of the entity
357358
"""
358359
schema_name = SchemaName(name=schema)
359360
entity_name = EntityName(schema=schema_name, name=entity)
360-
from_kwarg = {'from': From(scan=Scan(entity=entity_name))}
361+
from_kwarg = {'from': from_ if from_ else From(scan=Scan(entity=entity_name))}
361362
query = Query(**from_kwarg, projection=projection, where=where, order=order, limit=limit, skip=skip)
362363
responses = self._dql.Query(QueryMessage(metadata=Metadata(transactionId=self._tid), query=query))
363364
return [r for response in responses for r in self._parse_query_response(response)]

0 commit comments

Comments
 (0)