Coder Social home page Coder Social logo

Comments (5)

zzzeek avatar zzzeek commented on May 26, 2024

Am traveling this week. Will have time to look early next week if no one else is available to triage this

from sqlalchemy.

zzzeek avatar zzzeek commented on May 26, 2024

Law of twos with #11321

from sqlalchemy.

zzzeek avatar zzzeek commented on May 26, 2024

the correct parameter for setting the tablename on a decalrative base is __tablename__, not tablename. Fixing that, your program fails because you have an errant comma in your table definition:

sqlalchemy.exc.NoForeignKeysError: Can't find any foreign key relationships between '('subusers',)' and 'instance_subuser'.
                                                                                      ^^^^^^^^^^^ note tuple here


class SubUser(Base):
    tablename = 'subusers',
                         ^^^ errant comma here

    id = Column(Integer, primary_key = True)
    instances = relationship('Instance', secondary = InstanceSubuserRelationShipTable, back_populates='subusers')
    # Irrelevant parameters here...

from sqlalchemy.

ElHaban3ro avatar ElHaban3ro commented on May 26, 2024

Ironically it wasn't that (because later I fixed it and it kept throwing error), it was ',' after the 'tablename'. Biggest nonsense in the universe, I know.

from sqlalchemy.

CaselIT avatar CaselIT commented on May 26, 2024

just fyi, black and compatible formatters will format a one-tuple with parents, so your case would have become __tablename__ = ('subusers',), making it more visible when there are errant comma

from sqlalchemy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.