pyeve / eve-sqlalchemy

SQLAlchemy data layer for Eve-powered RESTful APIs
http://eve-sqlalchemy.readthedocs.io
Other
234 stars 70 forks source link

how to mix use mongo and sql? #118

Closed janreyho closed 8 years ago

janreyho commented 8 years ago

I think following is wrong, what it is the right? and teacher is mongo, people is sql. app.py

    settings = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'settings.py')
    apiapp = Eve(settings=settings, validator=ValidatorSQL, data=SQL)

    # bind SQLAlchemy
    db = apiapp.data.driver
    Base.metadata.bind = db.engine
    db.Model = Base
    db.create_all()

    evewta = EveWithTokenAuth(apiapp)
    apiapp.debug = True
    apiapp.run()

settings.py

  MONGO_HOST = 'localhost'
  MONGO_PORT = 27017
  MONGO_USERNAME = ''
  MONGO_PASSWORD = ''
  MONGO_DBNAME = 'maindb'

  URL_PREFIX = 'fudaoapi'
  API_VERSION = 'v1'
  TOKEN_SECRET = 'secret'
  SERVER_NAME = 'localhost:5000'

  registerSchema('people')(People)
  registerSchema('users')(Users)
  registerSchema('auth')(Auth)
  SQLALCHEMY_DATABASE_URI = 'mysql://xueba:Xue-83177@192.168.0.2:3306/xuebaedu'
...
...
...

  DOMAIN = {
    'teachers': teachers,
    'people': People._eve_schema['people'],
  }
janreyho commented 8 years ago

nicolaiarocci : there are no plans currently to support multiple data layers.900