Comments (10)
Query
.from_(table)
.join(table2, JoinType.left)
.on(...)
vs .
Query
.from_(table)
.left_join(table2)
.on(...)
I don't really see how the code is any more complicated from API perspective, but definitely not opposed to having some extra join functions that call join
passing in the JoinType enum. Feel free to raise a PR, i'll have a look right away.
from pypika.
Yes, when chaining the join
function, there is a kwarg called how
which takes a pypika.JoinType
value
from pypika.
#348
While writing the docs, I figured it wouldn't take more thn a couple of minutes to add these functions. Mind taking a look at seeing if it meets your expectations?
from pypika.
OMG why not just make an innerJoin function and leftJoin function?
Then you have covered 95% of all usecases for joins.
from pypika.
Because we have real use cases for right and outer joins as well. A single function with a join type argument resulted in less code which was easier to maintain.
from pypika.
But it creates more complicated code for people using the framework.
I mean, the purpose of this framework was to make it easier for people to write queries instead of using strings. But in this case, this framework results in more complicated code than SQL, so it defeats it's own purpose.
from pypika.
It would be nice to have the functions innerJoin
and leftJoin
(maybe also for rightJoin
).
What do you think to create these functions using the join
that PyPika already have?
It would be a small improvement and, maybe will leave the code clearer.
from pypika.
@airtonzanon Yes it would be nice to have a "syntax sugar" for the most common join types.
I spent some time googling the docs, and then eventually i found out how to make a left join from searching the code on github. It could be easier.
from pypika.
@dabaus I will look at improving the docs so ensure that the join types are clearly covered.
from pypika.
Nice thing @twheys .
@dabaus Do you want to implement it? I can help if you want, or create the PR. It's your call.
Also, I think, with this PR, we could improve the Documentation of this place. If we try to improve the docs bit a bit, we'll have everything updated.
from pypika.
Related Issues (20)
- Set up documentation automation HOT 2
- [bug] ImportError: cannot import name 'ClickHouseQuery' from 'pypika.dialects' (\.venv\lib\site-packages\pypika\dialects\__init__.py) HOT 8
- Handle AliasedQuery in backend during with statement
- Discuss automations
- Adding introspection to the PyPika query builder HOT 3
- can we get querybuilder object from stringified obj? HOT 3
- dialect parameter without effect HOT 1
- Pass kwargs through to `get_function_sql` HOT 3
- Improved parameter support
- When will the new version be released? HOT 3
- Accept `Table` as argument to `isin`
- Missing `ORDER BY ... NULLS FIRST | LAST` HOT 3
- CustomFunction HOT 1
- When select a list of fields and sql with [ ] HOT 1
- Generate sql error HOT 1
- Feature request.
- Failed to access JSON inner object using JSON functions HOT 2
- Field object is not callbable when trying to use returning clause
- CURRENT_DATE and CURRENT_TIME should appear without brackets HOT 1
- Not using namespaces for `set` seems to be wrong
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pypika.