All Projects → yfilali → graphql-pynamodb

yfilali / graphql-pynamodb

Licence: MIT License
Graphene PynamoDB Integration

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to graphql-pynamodb

graphene-sqlalchemy-filter
Filters for Graphene SQLAlchemy integration
Stars: ✭ 117 (+85.71%)
Mutual labels:  graphql-server, graphene
graphql-dotnet-relay
Relay support for graphql-dotnet
Stars: ✭ 13 (-79.37%)
Mutual labels:  relay, graphql-server
relay-compiler-plus
Custom relay compiler which supports persisted queries
Stars: ✭ 68 (+7.94%)
Mutual labels:  relay, graphql-server
Graphql Up
Get a ready-to-use GraphQL API for your schema
Stars: ✭ 415 (+558.73%)
Mutual labels:  relay, graphql-server
Graphene
GraphQL framework for Python
Stars: ✭ 6,964 (+10953.97%)
Mutual labels:  relay, graphene
Create Graphql
Command-line utility to build production-ready servers with GraphQL.
Stars: ✭ 441 (+600%)
Mutual labels:  relay, graphql-server
Parse Server
API server module for Node/Express
Stars: ✭ 19,165 (+30320.63%)
Mutual labels:  relay, graphql-server
Lighthouse Utils
An add-on to Lighthouse to auto-generate CRUD actions from types https://github.com/nuwave/lighthouse
Stars: ✭ 26 (-58.73%)
Mutual labels:  relay, graphql-server
koa-server
🗄️ GraphQL Back-end Server with Relay, Koa, MongoDB and Mongoose
Stars: ✭ 31 (-50.79%)
Mutual labels:  relay, graphql-server
serverless-todo-demo
Serverless todo web app demo
Stars: ✭ 64 (+1.59%)
Mutual labels:  dynamodb
fullstack-graphql-angular
Simple Fullstack GraphQL Application with Angular CLI + Redux. API built with Typescript + Express + GraphQL + Sequelize (supports MySQL, Postgres, Sqlite and MSSQL). WebApp built with Angular CLI + Redux + Async Middleware to access the API.
Stars: ✭ 67 (+6.35%)
Mutual labels:  graphql-server
graphenize
A cli tool to auto-generate Graphene model from json data
Stars: ✭ 12 (-80.95%)
Mutual labels:  graphene
typegraphql-relay
Relay-compliant GraphQL server using TypeGraphQL and TypeORM boilerplate.
Stars: ✭ 55 (-12.7%)
Mutual labels:  relay
subscription-graphql
Subscription POC with graphql and relay
Stars: ✭ 18 (-71.43%)
Mutual labels:  relay
relay-starter-kit
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, Material UI.
Stars: ✭ 3,513 (+5476.19%)
Mutual labels:  relay
react-relay-pokemon
Use React & Relay as your Pokedex!
Stars: ✭ 88 (+39.68%)
Mutual labels:  relay
neko-relay-land
Neko Neko Relay 自定义隧道落地端
Stars: ✭ 28 (-55.56%)
Mutual labels:  relay
telegram-stepfunctions-bot
Serverless Telegram bot made on 4 AWS Lambda chained by AWS Step Functions. All of this written on Serverless Framework using plugins.
Stars: ✭ 26 (-58.73%)
Mutual labels:  dynamodb
Perl6-GraphQL
Perl 6 implementation of GraphQL
Stars: ✭ 19 (-69.84%)
Mutual labels:  graphql-server
mimicsocks
just another TCP proxy
Stars: ✭ 14 (-77.78%)
Mutual labels:  relay

Graphene-PynamoDB Build Status Coverage Status PyPI version

A PynamoDB integration for Graphene.

Installation

For instaling graphene, just run this command in your shell

pip install graphene-pynamodb

Examples

Here is a simple PynamoDB model:

from uuid import uuid4
from pynamodb.attributes import UnicodeAttribute
from pynamodb.models import Model


class User(Model):
    class Meta:
        table_name = "my_users"
        host = "http://localhost:8000"

    id = UnicodeAttribute(hash_key=True)
    name = UnicodeAttribute(null=False)


if not User.exists():
    User.create_table(read_capacity_units=1, write_capacity_units=1, wait=True)
    User(id=str(uuid4()), name="John Snow").save()
    User(id=str(uuid4()), name="Daenerys Targaryen").save()

To create a GraphQL schema for it you simply have to write the following:

import graphene
from graphene_pynamodb import PynamoObjectType


class UserNode(PynamoObjectType):
    class Meta:
        model = User
        interfaces = (graphene.Node,)


class Query(graphene.ObjectType):
    users = graphene.List(UserNode)

    def resolve_users(self, args, context, info):
        return list(User.scan())


schema = graphene.Schema(query=Query)

Then you can simply query the schema:

query = '''
    query {
      users {
        name
      }
    }
'''
result = schema.execute(query)

To learn more check out the following examples:

Limitations

graphene-pynamodb includes a basic implementation of relationships using lists. OneToOne and OneToMany relationships are serialized as a List of the ids and unserialized lazyly. The limit for an item's size in DynamoDB is 400KB (see http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html) This means the total "row" size including the serialized relationship needs to fit within 400KB so make sure to use this accordingly.

In addition, scan operations on DynamoDB are unsorted by design. This means that there is no reliable way to get a paginated result (Cursor support) on a root PynamoConnectionField.

This means that if you need to paginate items, it is best to have them as a OneToMany relationship inside another Field (usually viewer or node).

Contributing

After cloning this repo, ensure dependencies are installed by running:

python setup.py install

After developing, the full test suite can be evaluated by running:

python setup.py test # Use --pytest-args="-v -s" for verbose mode
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].