Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -


I tried to create a new database in my project, but when I run the script, I get this error, I have another project, this type of definition worked before, but now it gets a single error. I am using Python 2.7.8 and the version of SQLAlchemy module is 0.9.8. By the way, using a project flask- SQLAlchemy, it works well, I'm confused. Traceback information is as follows:

  Traceback (most recent call final): File "D: / Projects / IOM / db_create.py", line 4, & lt; Module & gt; From the models the base file "D: \ Projects \ OO-IM \ models.py", in line 15, in the & lt; Module & gt; Column ( 'followed_id', int (), ForeignKey ( 'user.id')) file "C: \ Python27 \ lib \ site-packages \ SQLAlchemy \ SQL \ schema.py", line 369, __new__ schema = metadata. Schema file "C: \ Python27 \ lib \ site-packages \ SQLAlchemy \ SQL \ elements.py", line 662, AttributeError in __getattr__ key): Neither 'column' object nor 'comparator' object a characteristic SQLAlchemy 'schema' import create_engine, column, string, integer, text DATETIME ,, Boolean, ForeignKey, sqlalchemy.orm import sessionmaker, respect, declarative_base SQLALCHEMY_DATABASE_URI = "mysql sqlalchemy.ext.declarative table backref import: // root: mysqladmin @ Localhost: 3306 / oo_im charset = UTF8 "base = declarative_base () # agenda:? AttributeError: Neither the 'column' object nor the 'comparison' object is an attribute 'schema' friendship = table ('friendship', column ('follower_id', integer), foreign ('user.id')) , column ( "Anukrmit_aidi, int (), Videshiki ( 'Ughrkaidi'))) class U Ser (base): __tablename__ = 'user' id = column (integer), primary_key = true) account = column (string ( 32), Exclusive = True, empty = Fail) Password = Column (string (32), blank = false) = Relationships ("User", Secondary = Friendship, Athamikjayn = (Friendship .. Folr_aidi == id), Madyamikjon = (Friendshipskckfollowed_id == id), Bakf = Bakf ( "followers" lazy = "Dynamic"), lazy = "dynamic") def __init __ ( Self, account, password, back = none): self.account = account self.password = password if done later: For the user in following: self.follow (user) follow the def (self, user) Do: If not self.is_following (user): self.followed.append (user) follow the own DRF (self, use Actor): If self.is_following (user): self.followed.remove (Use R) return self Dif is_following (self-user): Return self.followed.filter (friendships.c.followed_id == user.id). Count ()> 0 square ChatLog (base): __tablename__ = 'chatlog' id = column (int (), primary_key = true) SENDER_ID = column (int (), ForeignKey ( 'user.id'), tap = false) receiver_id = column (integer (), () () (), =) Column = (text (), zero = false) engine = create_engine (SQLALCHEMY_DATABASE_URI, convert_unicode = true) DBSession = sessionmaker (dam = engine)  

Text after "

The table definition should be:

  friendship = table ('friendship', base metadata, column ('Follower_id', integer), foreigner ('user.id')), column ('indexed', type When defining tables using declarative syntax, metadata from base to class declaration, i.e.     Pre>  Base = declarative_base () class ChatLog (base)  

However, when defining the table using the old table syntax, the metadata should be clearly specified.


Comments

Popular posts from this blog

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -