-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor/2479/simplify databackend contract #2710
base: main
Are you sure you want to change the base?
Conversation
Still to do:
|
9b12350
to
28e92a0
Compare
Resolved |
return query.limit(1).execute()[0] | ||
|
||
def _wrap_results(self, query: Query, result, schema): | ||
pid = self.primary_id(query) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Errors will occur for tables not created by SuperDuper. For example, tables that already exist in database cannot have their schema
and primary_id
retrieved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Insert data into a table using a non-superduper method (such as ibis, SQL queries, etc.)
- Query the data from this table using superduper.
An error should occur.
def test_filter(db): | ||
db.cfg.auto_schema = True | ||
|
||
db['documents'].insert([{'x': i} for i in range(10)]) | ||
|
||
t = db['documents'] | ||
|
||
q = t.filter(t['x'] == 1) | ||
|
||
results = q.execute() | ||
|
||
assert len(results) == 1 | ||
|
||
assert results[0]['x'] == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to test multiple conditions and difference conditions
difference conditions:
- isin
>
- "!="
- ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
2db34b1
to
e80debb
Compare
e80debb
to
70b2929
Compare
Description
superduper.backends.base.query.Query
superduper_<impl>.Databackend
t.insert(...)
instead oft.insert().execute()
since we don't need to serialize insertionst.update
,t.delete
deprecatedt.filter(...).select(...).outputs(...)
, ort.like().(...)
ort.(...).like()
t.get()
to get one data point (eager)t.ids()
to get the ids (eager)t.subset(ids)
to subset a queryt.limit(n, offset=m)
to get a chunk of data.execute()
no longer returns a cursor, instead a simple listt.column == x
, replace witht['column'] == x
q.dict()['documents']