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

Can't validate argument 'bind_key' #2

Open
one-more-alex opened this issue May 11, 2015 · 1 comment
Open

Can't validate argument 'bind_key' #2

one-more-alex opened this issue May 11, 2015 · 1 comment

Comments

@one-more-alex
Copy link

After connecting active-sqlalchemy I got strange warnings:

/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/schema.py:552: SAWarning: Can't validate argument 'bind_key'; can't locate any SQLAlchemy dialect named 'bind'
self._validate_dialect_kwargs(kwargs)

  • Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
  • Restarting with stat
    /usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/schema.py:552: SAWarning: Can't validate argument 'bind_key'; can't locate any SQLAlchemy dialect named 'bind'
    self._validate_dialect_kwargs(kwargs)
@lexicalunit
Copy link

I am also having this issue.

from active_alchemy import SQLAlchemy
from flask import Flask

app = Flask(__name__)
db = SQLAlchemy('mysql+mysqldb://admin:admin@192.168.99.100:3306/my_database', app=app)

event_participants = db.Table(
    'event_participants', db.metadata,
    db.Column('event_id', db.Integer, db.ForeignKey('events.id')),
    db.Column('person_id', db.Integer, db.ForeignKey('persons.id')))


class Event(db.Model):
    __tablename__ = 'events'
    id = db.Column(db.Integer, primary_key=True)
    participants = db.relationship('Person',
                                   secondary='event_participants',
                                   backref='participating')


class Person(db.Model):
    __tablename__ = 'persons'
    id = db.Column(db.Integer, primary_key=True)

if __name__ == '__main__':
    app.run()

When I run this tiny representative example code I get the following warning:

$ python example.py
/path/to/my/site-packages/sqlalchemy/sql/base.py:291: SAWarning: Can't validate argument 'bind_key'; can't locate any SQLAlchemy dialect named 'bind'
  (k, dialect_name))
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

In this example I am setting up a many-to-many relationship between events and persons. Meaning 1) there can be many events a person is participating in and 2) many persons can be attending an event. Documentation for setting up this kind of relationship with SQLAlchemy can be found here: http://docs.sqlalchemy.org/en/latest/orm/basic_relationships.html#many-to-many which is what the structure for my example code is based on.

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

No branches or pull requests

2 participants