Skip to content

fixed model column name [sqlalchemy] - #204

Merged
syrusakbary merged 1 commit into
graphql-python:masterfrom
pyoner:master
Jun 18, 2016
Merged

syrusakbary merged 1 commit into
graphql-python:masterfrom
pyoner:master

Conversation

@pyoner

@pyoner pyoner commented Jun 13, 2016

Copy link
Copy Markdown
Contributor

I have existing db and create User model for that db using automap_base

import os

from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey

Base = automap_base()
class User(Base):
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
    email = Column('mail', String(100))
    password = Column('pass', String(32))

engine = create_engine(os.getenv('DATABASE_URI'))
# reflect the tables
Base.prepare(engine, reflect=True)

but if I use query for users

query {
  users {
    edges {
      node {
        about
        email
        password
      }
    }
  }
}

fields email and password doesn't exists because these fields are redefined in the model

@coveralls

coveralls commented Jun 13, 2016 •

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 96.144% when pulling 67fe978 on pyoner:master into 1711e6a on graphql-python:master.

@syrusakbary
syrusakbary merged commit 5310837 into graphql-python:master Jun 18, 2016
@syrusakbary

Copy link
Copy Markdown
Member

Makes sense! Thanks for the fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants