Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django integration #1

Open
ranjanprj opened this issue Apr 6, 2020 · 1 comment
Open

Django integration #1

ranjanprj opened this issue Apr 6, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@ranjanprj
Copy link

First of all, I've been looking all over for something like this in Python, lucky to find Nebulo.
Kudos.

I mostly work in the Django space, and would like to expose some tables and views using something like Nebulo, is there an easy way to pass the django.connection which holds the DB connection into this and it starts to work automatically.

Let me know.

@olirice
Copy link
Owner

olirice commented Apr 6, 2020

Thanks, that's really nice to hear!

There is no public api or documentation for usage as a library yet, so any integrations you try to make will be unstable for a while. If you just want to try it out, you could do something like

from nebulo.server.flask import create_app
from graphql.type import GraphQLSchema

# connection is your connection string from django config
app = create_app(connection="connection string", schema='public', echo_queries=False)

schema: GraphQLSchema = app.config["graphql_schema"]
engine = app.config['engine']
session = app.config["database"].session

From there you can execute queries against that schema using standard python-graphql ecosystem using nebulo's database engine and session (sqlalchemy).

Hope that helps

Leaving this open for other django related discusssion

@olirice olirice changed the title Can this be integrated within Django Django integration Apr 6, 2020
@olirice olirice added the enhancement New feature or request label Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants