masoniteframework / orm Goto Github PK
View Code? Open in Web Editor NEWMasonite ORM is a beautiful Python ORM. It's also a nearly drop in replacement of the Orator ORM
Home Page: https://orm.masoniteproject.com
License: MIT License
Masonite ORM is a beautiful Python ORM. It's also a nearly drop in replacement of the Orator ORM
Home Page: https://orm.masoniteproject.com
License: MIT License
Normally we would do something like:
.where('age', '>', 5).where('age', '<', '10')
We should be able to do a
.where_between('age', 5, 10)
as a shorthand for the above.
It should be added to this class https://github.com/MasoniteFramework/orm/blob/0.1/src/masonite/orm/builder/QueryBuilder.py
and look like this:
def where_between(self, column, low, high):
return self.where(column, '>', low).where(column, '<', high)
Need to start experimenting with adding scopes to queries
Need to have the ability to add a factory. Really need to work on this structure. Im not entirely sold on how Orator does it
We will primarily be using qmark for the actual calls to the database. The to_sql()
will return normal sql which we are using the make sure the queries line up but we need to make sure all the bindings line up correctly
need to be able to do builder.where_null('column').get()
which would compile down to:
SELECT * FROM `users` WHERE `column` IS NULL
need to be able to do builder.where_not_null('column').get()
which would compile down to:
SELECT * FROM `users` WHERE `column` IS NOT NULL
Need to wait for MySQL grammar to finish
need to create an exists query which is simple and EXISTS with a subquery
We need to be able to emit (maybe using python logger) and have listeners so we can build integrations that do things like show the query and the time they took to execute
should be in a format like
table.foreign('user_id').references('id').on('users')
The _compile_where method is getting really big and messy. Now that there are tests around all the different parts it is a good time to refactor that method
right now can do schema.drop('column')
. Should be able to do schema.drop('column1', 'column2')
The foundation and tests are in place but will need to refactor
right now you need to set the __table__
attribute. we need to be able to figure it out with the table name.
For example, the User
model would be users
table
Need to be able to do drop_primary
, drop_unique
and drop_index
Need to be able to set a default length. For example, on MySQL it can be 255 but for Maria youll need to set it up to 191
Need to be able to do where_raw("x = 1")
Need to be able to make a query like this:
SELECT * FROM `users` where `column1` = `column2`
Need to add both drop table schema and drop table if exists schema.
2 tests are commented out and located in the tests/schema/mysql/test_mysql_schema.py
file
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.