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

Hints do not work with imported Base #246

Open
Phinnik opened this issue Aug 19, 2022 · 1 comment
Open

Hints do not work with imported Base #246

Phinnik opened this issue Aug 19, 2022 · 1 comment

Comments

@Phinnik
Copy link

Phinnik commented Aug 19, 2022

There are no hints in PyCharm for models, which inherit declarative base from another module.
Here is example:

# base.py
import re

from sqlalchemy import Column, Integer, DateTime
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.sql import func
from sqlalchemy.ext.declarative import declarative_base


class Base:
    @declared_attr
    def __tablename__(cls):
        return cls.__name__.lower()

    id = Column(Integer, primary_key=True, index=True)
    created_at = Column(DateTime(timezone=True), nullable=False, server_default=func.now())


Base = declarative_base(cls=Base)
# models.py
from base import Base
from sqlalchemy import Integer, String, Column


class SomeModel(Base):
    id = Column(Integer, primary_key=True)
    name = Column(String)
    description = Column(String)

изображение

@denyszhak
Copy link

@Phinnik

Doesn't seem to be an issue for me in VS Code. Are you sure you are pointing to the right environment in Pycharm?

image

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