D
Deleted member 43669
Guest
Let's say I have a small relational database (largest table ~100.000 rows) and I want to be people to write very simple scripts which will allow to "extract" objects from the information in the database in non trivial ways, "dot-walking" ways. I would like them to say stuff such as:
where foo.c.d.e means access through foreign key relationships.
I was thinking having people write SQL views that look like the output objects (which are basically plain-key value), and write denormalizing views to simplify the dot walking stuff but a) people tend to be allergic to SQL and b) some SQL views would be very ugly and unmaintanable with lots of CASE, COALESCE, LEFT JOINs, etc.
One alternative would be to use say, Python, use an ORM and the rules would be plain Python code, but I'm concerned that even though the dataset is small, we would be burnt by thousands of N+1 queries problems.
Is there something that would me let me do ORM-like access on in-memory data with minimal per-query cost which would allow quick loading of the data from the database into memory? I think LINQ does it, but we are most familiar with Python...
Code:
for each row foo in table foos where foos.x = 'b'
create a new bar object with fields:
bar.x = foo.a
bar.y = foo.b
bar.z = foo.c.d.e
bar.t = if foo.d.a > 3 then 4 else 1
where foo.c.d.e means access through foreign key relationships.
I was thinking having people write SQL views that look like the output objects (which are basically plain-key value), and write denormalizing views to simplify the dot walking stuff but a) people tend to be allergic to SQL and b) some SQL views would be very ugly and unmaintanable with lots of CASE, COALESCE, LEFT JOINs, etc.
One alternative would be to use say, Python, use an ORM and the rules would be plain Python code, but I'm concerned that even though the dataset is small, we would be burnt by thousands of N+1 queries problems.
Is there something that would me let me do ORM-like access on in-memory data with minimal per-query cost which would allow quick loading of the data from the database into memory? I think LINQ does it, but we are most familiar with Python...