Is your feature request related to a problem?
At the moment when you use the SDK it forces a SELECT * FROM $thing. This prevents the scenario where you'd only want a single field to conserve data / compute / memory usage. This also prevents usage of relationships. for example ->tenant is not included by default.
Describe the solution
In my opinion the most pythonic way to do this is the following. Acccept a list[str] as a fields kwarg with the current * as a default fallback method. This would make implementation quite easy in the query, would be easy for the user to implement, and would not break existing implementation. This would allow this feature to be introduced without breaking changes.
Example:
db.select("user", fields=["name", "->tenant"])
db.select("user") # Would still work and when None is passed in the fields it should just do *
Alternative methods
I've seen the JS SDK does chained methods so db.select("user").fields(["name", "->tenant"]). This is probably not the best approach and more difficult to implement in Python.
SurrealDB version
3.0.0 for macos on aarch64
surrealdb.py version
main
Contact Details
kevin.oosterhout@nuxnova.io
Is there an existing issue for this?
Code of Conduct for repository surrealdb/surrealdb.py
Is your feature request related to a problem?
At the moment when you use the SDK it forces a
SELECT * FROM $thing. This prevents the scenario where you'd only want a single field to conserve data / compute / memory usage. This also prevents usage of relationships. for example->tenantis not included by default.Describe the solution
In my opinion the most pythonic way to do this is the following. Acccept a
list[str]as afieldskwarg with the current * as a default fallback method. This would make implementation quite easy in the query, would be easy for the user to implement, and would not break existing implementation. This would allow this feature to be introduced without breaking changes.Example:
Alternative methods
I've seen the JS SDK does chained methods so
db.select("user").fields(["name", "->tenant"]). This is probably not the best approach and more difficult to implement in Python.SurrealDB version
3.0.0 for macos on aarch64
surrealdb.py version
main
Contact Details
kevin.oosterhout@nuxnova.io
Is there an existing issue for this?
Code of Conduct for repository surrealdb/surrealdb.py