Skip to content

Commit

Permalink
version up to 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kotolex committed May 15, 2024
1 parent da9b501 commit 5a15059
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Works and tested on Ubuntu, macOS, Windows 10, can use python 3.8+ (including py
* only one small dependency (websocket-client), no need to pull a lot of libraries to your project
* fully documented
* well tested (on the latest Ubuntu, macOS and Windows 10)
* fully compatible with the latest version of SurrealDB (1.4.2), including [live queries](https://surrealdb.com/products/lq) and [change feeds](https://surrealdb.com/products/cf)
* fully compatible with the latest version of SurrealDB (1.5.0), including [live queries](https://surrealdb.com/products/lq) and [change feeds](https://surrealdb.com/products/cf)
* debug mode to see all that goes in and out if you need
* iterator to handle big select queries
* QL-builder to explore, generate and use SurrealDB queries (explain, transaction etc.)
Expand Down
5 changes: 3 additions & 2 deletions src/surrealist/ql/statements/rebuild_index.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from typing import List

from .statement import Statement
from surrealist.utils import OK
from surrealist.connections import Connection
from surrealist.utils import OK
from .statement import Statement


class RebuildIndex(Statement):
Expand All @@ -13,6 +13,7 @@ class RebuildIndex(Statement):
Examples: https://github.com/kotolex/surrealist/blob/master/examples/surreal_ql/database.py
"""

def __init__(self, connection: Connection, index_name: str, table_name: str, if_exists: bool = False):
super().__init__(connection)
self._name = index_name
Expand Down
10 changes: 10 additions & 0 deletions src/surrealist/ql/statements/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,20 @@ def validate(self) -> List[str]:
return [OK] if not result else result

def limit(self, limit: int) -> "Show":
"""
Limits number of results to show (LIMIT statement)
:param limit: number of results
:return: Show object
"""
self._limit = limit
return self

def since(self, timestamp: str) -> "Show":
"""
Init timestamp since is to show updates
:param timestamp: surreal timestamp
:return: Show object
"""
self._since = timestamp
return self

Expand Down
8 changes: 8 additions & 0 deletions src/surrealist/ql/statements/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@


def combine(result: Optional[str], kwargs: Dict) -> str:
"""
Combine optional raw string representation with optional keyword-arguments. Used in relate/create/update statements
for set methods
:param result: raw string representation for query
:param kwargs: optional parameters
:return: string combined
"""
first = result if result else ''
second = ", ".join(f"{k} = {json.dumps(v)}" for k, v in kwargs.items()) if kwargs else ''
args = ', '.join(element for element in (first, second) if element)
Expand Down

0 comments on commit 5a15059

Please sign in to comment.