python - SQLAlchemy and pylint -


sqlalchemy seems give me ton of errors on pylint can't resolve.

the first problem each table must defined new class.

example:

class person(base):     """person table definition"""     __tablename__ = 'person'     id = column(integer, primary_key=true)     name = column(string(30)) 

...causes these errors for each table define:

w: 20, 0: class has no __init__ method (no-init) r: 20, 0: few public methods (0/2) (too-few-public-methods) 

the second problem using global variable sqlalchemy engine , base constructs. i'm not sure how can refactor code make these variables not global, since parameter base must passed table class definitions above.

base = sqlalchemy.ext.declarative.declarative_base() global engine ... def create_sqla_engine():     """create sqla engine"""     global engine     engine = create_engine('mysql+mysqlconnector://root:@127.0.0.1:3306/sqlalchemy_example') 

i'm new python seems ugly. pylint complains it, too:

c: 51, 0: invalid constant name "engine" (invalid-name) 

finally, pylint thinks i'm not using imports using in code.

w: 15, 0: unused declarative_base imported sqlalchemy.ext.declarative (unused-import) w: 16, 0: unused sessionmaker imported sqlalchemy.orm (unused-import) 

...why? pylint not compatible python3? should importing modules need within methods used, instead of @ top of file?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -