PeterH Posted April 28, 2020 Report Share Posted April 28, 2020 I like the API but I'm not a huge fan of writing the queries as text, so I made something a while back using inspiration from SQLAlchemy. As a very quick example, if the original code is this: episode = session.query('Episode').first() task_link = session.query('select link from Task where (name not like "%task%" or name is "new") and parent.id is "{}" order by name descending'.format(episode['id'])).first() It would be constructed like this: task_link = session.Task.where( or_(~entity.name.like('%task%'), name='new'), parent=session.Episode.first(), ).select(entity.link).sort(entity.name.desc()).first() It's able to do everything I've come across so far, if anyone is interested in using it the github page is here. Lorenzo Angeli 1 Link to comment Share on other sites More sharing options...
Guest Posted May 12, 2020 Report Share Posted May 12, 2020 Hey Peter, nice work! I've been thinking about something like this myself--I love tab-completable everything and am excited to give this a try. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now