7
7
8
8
class AsyncTemplate :
9
9
10
- async def connect (self , url : str ) -> Coroutine [ Any , Any , None ] :
10
+ async def connect (self , url : str ) -> None :
11
11
"""Connects to a local or remote database endpoint.
12
12
13
13
Args:
@@ -18,17 +18,17 @@ async def connect(self, url: str) -> Coroutine[Any, Any, None]:
18
18
# Connect to a remote endpoint
19
19
await db.connect('https://cloud.surrealdb.com/rpc');
20
20
"""
21
- raise NotImplementedError (f"query not implemented for: { self } " )
21
+ raise NotImplementedError (f"connect not implemented for: { self } " )
22
22
23
- async def close (self ) -> Coroutine [ Any , Any , None ] :
23
+ async def close (self ) -> None :
24
24
"""Closes the persistent connection to the database.
25
25
26
26
Example:
27
27
await db.close()
28
28
"""
29
- raise NotImplementedError (f"query not implemented for: { self } " )
29
+ raise NotImplementedError (f"close not implemented for: { self } " )
30
30
31
- async def use (self , namespace : str , database : str ) -> Coroutine [ Any , Any , None ] :
31
+ async def use (self , namespace : str , database : str ) -> None :
32
32
"""Switch to a specific namespace and database.
33
33
34
34
Args:
@@ -38,9 +38,9 @@ async def use(self, namespace: str, database: str) -> Coroutine[Any, Any, None]:
38
38
Example:
39
39
await db.use('test', 'test')
40
40
"""
41
- raise NotImplementedError (f"query not implemented for: { self } " )
41
+ raise NotImplementedError (f"use not implemented for: { self } " )
42
42
43
- async def authenticate (self , token : str ) -> Coroutine [ Any , Any , None ] :
43
+ async def authenticate (self , token : str ) -> None :
44
44
"""Authenticate the current connection with a JWT token.
45
45
46
46
Args:
@@ -51,15 +51,15 @@ async def authenticate(self, token: str) -> Coroutine[Any, Any, None]:
51
51
"""
52
52
raise NotImplementedError (f"authenticate not implemented for: { self } " )
53
53
54
- async def invalidate (self ) -> Coroutine [ Any , Any , None ] :
54
+ async def invalidate (self ) -> None :
55
55
"""Invalidate the authentication for the current connection.
56
56
57
57
Example:
58
58
await db.invalidate()
59
59
"""
60
60
raise NotImplementedError (f"invalidate not implemented for: { self } " )
61
61
62
- async def signup (self , vars : Dict ) -> Coroutine [ Any , Any , str ] :
62
+ async def signup (self , vars : Dict ) -> str :
63
63
"""Sign this connection up to a specific authentication scope.
64
64
[See the docs](https://surrealdb.com/docs/sdk/python/methods/signup)
65
65
@@ -81,7 +81,7 @@ async def signup(self, vars: Dict) -> Coroutine[Any, Any, str]:
81
81
"""
82
82
raise NotImplementedError (f"signup not implemented for: { self } " )
83
83
84
- async def signin (self , vars : Dict ) -> Coroutine [ Any , Any , str ] :
84
+ async def signin (self , vars : Dict ) -> str :
85
85
"""Sign this connection in to a specific authentication scope.
86
86
[See the docs](https://surrealdb.com/docs/sdk/python/methods/signin)
87
87
@@ -94,9 +94,9 @@ async def signin(self, vars: Dict) -> Coroutine[Any, Any, str]:
94
94
password: 'surrealdb',
95
95
})
96
96
"""
97
- raise NotImplementedError (f"query not implemented for: { self } " )
97
+ raise NotImplementedError (f"signin not implemented for: { self } " )
98
98
99
- async def let (self , key : str , value : Any ) -> Coroutine [ Any , Any , None ] :
99
+ async def let (self , key : str , value : Any ) -> None :
100
100
"""Assign a value as a variable for this connection.
101
101
102
102
Args:
@@ -115,7 +115,7 @@ async def let(self, key: str, value: Any) -> Coroutine[Any, Any, None]:
115
115
"""
116
116
raise NotImplementedError (f"let not implemented for: { self } " )
117
117
118
- async def unset (self , key : str ) -> Coroutine [ Any , Any , None ] :
118
+ async def unset (self , key : str ) -> None :
119
119
"""Removes a variable for this connection.
120
120
121
121
Args:
@@ -124,11 +124,11 @@ async def unset(self, key: str) -> Coroutine[Any, Any, None]:
124
124
Example:
125
125
await db.unset('name')
126
126
"""
127
- raise NotImplementedError (f"let not implemented for: { self } " )
127
+ raise NotImplementedError (f"unset not implemented for: { self } " )
128
128
129
129
async def query (
130
130
self , query : str , vars : Optional [Dict ] = None
131
- ) -> Coroutine [ Any , Any , Union [List [dict ], dict ] ]:
131
+ ) -> Union [List [dict ], dict ]:
132
132
"""Run a unset of SurrealQL statements against the database.
133
133
134
134
Args:
@@ -145,7 +145,7 @@ async def query(
145
145
146
146
async def select (
147
147
self , thing : Union [str , RecordID , Table ]
148
- ) -> Coroutine [ Any , Any , Union [List [dict ], dict ] ]:
148
+ ) -> Union [List [dict ], dict ]:
149
149
"""Select all records in a table (or other entity),
150
150
or a specific record, in the database.
151
151
@@ -158,13 +158,13 @@ async def select(
158
158
Example:
159
159
db.select('person')
160
160
"""
161
- raise NotImplementedError (f"query not implemented for: { self } " )
161
+ raise NotImplementedError (f"select not implemented for: { self } " )
162
162
163
163
async def create (
164
164
self ,
165
165
thing : Union [str , RecordID , Table ],
166
166
data : Optional [Union [List [dict ], dict ]] = None ,
167
- ) -> Coroutine [ Any , Any , Union [List [dict ], dict ] ]:
167
+ ) -> Union [List [dict ], dict ]:
168
168
"""Create a record in the database.
169
169
170
170
This function will run the following query in the database:
@@ -181,7 +181,7 @@ async def create(
181
181
182
182
async def update (
183
183
self , thing : Union [str , RecordID , Table ], data : Optional [Dict ] = None
184
- ) -> Coroutine [ Any , Any , Union [List [dict ], dict ] ]:
184
+ ) -> Union [List [dict ], dict ]:
185
185
"""Update all records in a table, or a specific record, in the database.
186
186
187
187
This function replaces the current document / record data with the
@@ -207,11 +207,11 @@ async def update(
207
207
},
208
208
})
209
209
"""
210
- raise NotImplementedError (f"query not implemented for: { self } " )
210
+ raise NotImplementedError (f"update not implemented for: { self } " )
211
211
212
212
async def upsert (
213
213
self , thing : Union [str , RecordID , Table ], data : Optional [Dict ] = None
214
- ) -> Coroutine [ Any , Any , Union [List [dict ], dict ] ]:
214
+ ) -> Union [List [dict ], dict ]:
215
215
"""Insert records into the database, or to update them if they exist.
216
216
217
217
@@ -239,7 +239,7 @@ async def upsert(
239
239
240
240
async def merge (
241
241
self , thing : Union [str , RecordID , Table ], data : Optional [Dict ] = None
242
- ) -> Coroutine [ Any , Any , Union [List [dict ], dict ] ]:
242
+ ) -> Union [List [dict ], dict ]:
243
243
"""Modify by deep merging all records in a table, or a specific record, in the database.
244
244
245
245
This function merges the current document / record data with the
@@ -267,11 +267,11 @@ async def merge(
267
267
})
268
268
269
269
"""
270
- raise NotImplementedError (f"query not implemented for: { self } " )
270
+ raise NotImplementedError (f"merge not implemented for: { self } " )
271
271
272
272
async def patch (
273
273
self , thing : Union [str , RecordID , Table ], data : Optional [Dict ] = None
274
- ) -> Coroutine [ Any , Any , Union [List [dict ], dict ] ]:
274
+ ) -> Union [List [dict ], dict ]:
275
275
"""Apply JSON Patch changes to all records, or a specific record, in the database.
276
276
277
277
This function patches the current document / record data with
@@ -296,11 +296,11 @@ async def patch(
296
296
{ 'op': "remove", "path": "/temp" },
297
297
])
298
298
"""
299
- raise NotImplementedError (f"query not implemented for: { self } " )
299
+ raise NotImplementedError (f"patch not implemented for: { self } " )
300
300
301
301
async def delete (
302
302
self , thing : Union [str , RecordID , Table ]
303
- ) -> Coroutine [ Any , Any , Union [List [dict ], dict ] ]:
303
+ ) -> Union [List [dict ], dict ]:
304
304
"""Delete all records in a table, or a specific record, from the database.
305
305
306
306
This function will run the following query in the database:
@@ -324,11 +324,11 @@ async def info(self) -> Coroutine[Any, Any, dict]:
324
324
Example:
325
325
await db.info()
326
326
"""
327
- raise NotImplementedError (f"query not implemented for: { self } " )
327
+ raise NotImplementedError (f"info not implemented for: { self } " )
328
328
329
329
async def insert (
330
330
self , table : Union [str , Table ], data : Union [List [dict ], dict ]
331
- ) -> Coroutine [ Any , Any , Union [List [dict ], dict ] ]:
331
+ ) -> Union [List [dict ], dict ]:
332
332
"""
333
333
Inserts one or multiple records in the database.
334
334
@@ -343,11 +343,11 @@ async def insert(
343
343
await db.insert('person', [{ name: 'Tobie'}, { name: 'Jaime'}])
344
344
345
345
"""
346
- raise NotImplementedError (f"query not implemented for: { self } " )
346
+ raise NotImplementedError (f"insert not implemented for: { self } " )
347
347
348
348
async def insert_relation (
349
349
self , table : Union [str , Table ], data : Union [List [dict ], dict ]
350
- ) -> Coroutine [ Any , Any , Union [List [dict ], dict ] ]:
350
+ ) -> Union [List [dict ], dict ]:
351
351
"""
352
352
Inserts one or multiple relations in the database.
353
353
@@ -362,11 +362,11 @@ async def insert_relation(
362
362
await db.insert_relation('likes', { in: person:1, id: 'object', out: person:2})
363
363
364
364
"""
365
- raise NotImplementedError (f"query not implemented for: { self } " )
365
+ raise NotImplementedError (f"insert_relation not implemented for: { self } " )
366
366
367
367
async def live (
368
368
self , table : Union [str , Table ], diff : bool = False
369
- ) -> Coroutine [ Any , Any , UUID ] :
369
+ ) -> UUID :
370
370
"""Initiates a live query for a specified table name.
371
371
372
372
Args:
@@ -381,11 +381,11 @@ async def live(
381
381
Example:
382
382
await db.live('person')
383
383
"""
384
- raise NotImplementedError (f"query not implemented for: { self } " )
384
+ raise NotImplementedError (f"live not implemented for: { self } " )
385
385
386
386
async def subscribe_live (
387
387
self , query_uuid : Union [str , UUID ]
388
- ) -> Coroutine [ Any , Any , Queue ] :
388
+ ) -> Queue :
389
389
"""Returns a queue that receives notification messages from a running live query.
390
390
391
391
Args:
@@ -397,9 +397,9 @@ async def subscribe_live(
397
397
Example:
398
398
await db.subscribe_live(UUID)
399
399
"""
400
- raise NotImplementedError (f"query not implemented for: { self } " )
400
+ raise NotImplementedError (f"subscribe_live not implemented for: { self } " )
401
401
402
- async def kill (self , query_uuid : Union [str , UUID ]) -> Coroutine [ Any , Any , None ] :
402
+ async def kill (self , query_uuid : Union [str , UUID ]) -> None :
403
403
"""Kills a running live query by it's UUID.
404
404
405
405
Args:
@@ -409,4 +409,4 @@ async def kill(self, query_uuid: Union[str, UUID]) -> Coroutine[Any, Any, None]:
409
409
await db.kill(UUID)
410
410
411
411
"""
412
- raise NotImplementedError (f"query not implemented for: { self } " )
412
+ raise NotImplementedError (f"kill not implemented for: { self } " )
0 commit comments