Manipute query before it is handled by adaptor #418
Replies: 1 comment 1 reply
-
Adapters receive the predicates in the from shillelagh.adapters.registry import registry
from shillelagh.backends.apsw.db import connect
from fakes import FakeAdapter
class DebugAdapter(FakeAdapter):
scheme = "debug"
def get_data(self, bounds, *args, **kwargs):
print(bounds)
return super().get_data(bounds, *args, **kwargs)
registry.add("debug", DebugAdapter)
connection = connect(":memory:", ["debug"])
cursor = connection.cursor()
cursor.execute('SELECT * FROM "debug://" WHERE age = 1') And running it: % cd shillelagh/tests/
% python test.py
{'age': ==1} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
Problem statement: take "WHERE" part of query as input and using that manipulate the "FROM" part of query (set as query params or headers in rest uri).
any approach or ideas for this will be helpful, because as far as i could explore, adaptors are not getting the "WHERE" part of query.
Beta Was this translation helpful? Give feedback.
All reactions