In py file 1 I have data model classes.
In py file 2, I have imported a class from the first py file.
When I reference an instance of an imported class from file 1 in file 2, I can't get the IDE to show the properties of the class.
I've documented my attempts to resolve this
here
Can anyone shed some light on this for me please.
(Using Python 3.6.5 on Windows 2012 RC2 and VS Code 1.23.1)
All I get as options are:
...
end
file
flush
sep
value
Most difficult without seeing actual code
The link had most of the code.... :-(
setup.py:
from distutils.core import setup
setup(
name='TidalConversion',
version='0.1dev',
packages=['tidalconversion',],
license='Creative Commons Attribution-Noncommercial-Share Alike license',
long_description=open('README.txt').read(),
)
__init__.py:
#!/usr/bin/env python
import os
from tidal import *
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
engine = create_engine(os.environ['DATABASE_URL'], echo=False) #echo='debug'
Session = sessionmaker(bind=engine)
main code
from tidalconversion import Session, engine, Jobmst
jobrow = session.query(Jobmst).filter(Jobmst.jobmst_id==job['jobmst_id']).first()
If I try and do something like
print(jobrow. and press ctrl+space I don't get any of the columns - like jobmst_id for example.
I can confirm that if I printed the type of jobrow - it would be of type tidal.Jobmst
The classes in the tidal.py file are just code generated by SQLACODEGEN, representing database tables and the relationships between for use with SQLAlchemy
I recorded a video of the issue
here
I posted on Stack Overflow
here
I found
PEP0526 resolved this. Thanks to
Ilja Everilä on Stack Overflow.
So I ended up with code like so:
jobrow = session.query(Jobmst).filter(Jobmst.jobmst_id==job['jobmst_id']).first() # type: Jobmst
Have
asked guys at SQLAlchemy if they can integrate these code hint comments into their library rather than have it at the 'client' code level.