graphql-python / graphql-python/graphene-sqlalchemy

Consider sharing implementation with graphene-django

未關閉
#202 7 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
985
分支
223
PR 合併指標
30 天內沒有已合併 PR

描述

### Problem ###
I was surprised to see that [`graphene-django`](https://github.com/graphql-python/graphene-django) shares a considerable amount of code with this library. Almost line-for-line in some instances if you blur your eyes to the types. Unfortunately that means it also shares some common bugs, missing features, etc...

Worse-off for this library, the [graphene "team"](https://graphene-python.org/team) seems to prefer `graphene-django` by a 3-0 vote. Which might explain why that package has additional features over this one 😉. Not to mention, there also several `graphene-django-*` packages that tack on to `grpahene-django`[1]

Both libraries essentially represent the same thing: gluing your Python SQL ORM into graphene types. (Note that these aren't the only players on the field either [2])

### Proposal ###
Find the middle ground for "here's how to take a declarative ORM and transform it into `graphene` types", and have `graphene-django` and `graphene-sqlalchemy` fill in the ORM-specific slots (how do I convert this ORM field type to a `graphene` field type?, etc...) and add additional features offered by that ORM.

This means that contributors who can bring valuable `graphene` expertise can contribute without heavy knowledge of an ORM, and aren't splintered across repos. Valuable features can be added to a single scaffold repo and then be filled by the implementation-specific repos much easier.
It would also mean core features/issues are located in one library.

I've outlined below (what I think) the key features that a shared library should attempt to solve, in addition to reducing the amount code copied between the two libraries.

### Similar issues/features ###
Description | django issue | sqlalchemy issue
------------ | ------------- | -------------
don't overfetch data| [402](https://github.com/graphql-python/graphene-django/issues/402) | [134](https://github.com/graphql-python/graphene-sqlalchemy/issues/134)
field/node level permissions | [485](https://github.com/graphql-python/graphene-django/issues/485) | [186](https://github.com/graphql-python/graphene-sqlalchemy/issues/186)
filtering | supported | [110](https://github.com/graphql-python/graphene-sqlalchemy/issues/110), [16](https://github.com/graphql-python/graphene-sqlalchemy/issues/16)
N+1 | `graphene-django-optimizer` | [35](https://github.com/graphql-python/graphene-sqlalchemy/issues/35)

(there's more issues/features duplicated between the two, but those are the "big ones" IMO that stop these libraries form being true works of art)

### drawbacks ###
With maintenance being scattered, it might be hard to find the right people to create/maintain such a library. Furthermore, maintenance/contributions would need to generic enough to satisfy several downstream libraries. However, from what I've seen scouring the issues and related libraries, there's no shortage of people willing to solve the hard problems. 👍

#### notable parties ####
@syrusakbary @jnak @Nabellaleen @Cito @patrick91 (plus whoever else y'all wanna tag)

#

[1] [`graphene-django-tools`](https://github.com/NateScarlet/graphene-django-tools), [`graphene-django-optimizer`](https://github.com/tfoxy/graphene-django-optimizer), etc...
[2] @coleifer who authored [Peewee](http://docs.peewee-orm.com/en/latest/) showed interest in support ([graphene#289](https://github.com/graphql-python/graphene/issues/289)) but recently said it wasn't being pursued ([peewee#1790](https://github.com/coleifer/peewee/issues/1790))

貢獻指南

開啟貢獻指南

研究方向

先比較 graphene-django 和 graphene-sqlalchemy 中重複的實作,然後檢視涵蓋 overfetching、權限、篩選和 N+1 查詢的相關 issue。完成這項工作需要就共用函式庫的邊界以及 ORM 特定整合的計畫達成共識;該 issue 未列出檔案、測試或進入點。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python, sqlalchemy
領域
backend-api-design, databases
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
需要釐清
新手友好度
20/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。