Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8923077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:01:12+00:00 2026-06-15T07:01:12+00:00

total novice here. Trying to work with sqlalchemy but have hit a problem. class

  • 0

total novice here. Trying to work with sqlalchemy but have hit a problem.

class Establishment(Base):
__tablename__ = 'establishments'

estaID = Column(String(5), primary_key=True)
typeID = Column(String(2), ForeignKey('types.typeID'))

type = relationship("Type", backref=backref('estabs', order_by=estaID))

def __init__(self, id):
    self.estaID = id

    try:
        session = Session()

        existsEsta = session.query(Establishment).filter(Establishment.estaID == self.estaID).one()
        session.close()

        self.typeID = existsEsta.typeID

    except NoResultFound, e:
        session = Session()

        print "Establishment: ", self.estaID, "does not yet exist."
        type = Type(raw_input("Please enter type: "))

        self.typeID = type.gettypeID()

        print "Adding establishment", self.estaID, self.typeID

        session.add(self)

        session.commit

For some reason, the session.add(self) is not adding the record to the db. I’m having particular difficult figuring out what’s going on because this “Establishment” class is modeled after another class (identical algorithm, different variable names) which works just fine.

Thoughts as to where I’m going wrong here?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:01:15+00:00Added an answer on June 15, 2026 at 7:01 am

    Try session.commit() instead of session.commit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Total Novice here. I have some list items. I need to add a class
I am a total novice at jQuery, but giving it a go. I cant
Total noob here with javascript. I'm trying to alter a function. This is the
Total noob question, but here. CSS .product__specfield_8_arrow { /*background-image:url(../../upload/orng_bg_arrow.png); background-repeat:no-repeat;*/ background-color:#fc0; width:50px !important; height:33px
total nubi here and i'm trying to writ an application that trackes how far
Am fairly new to using MySQL and a total novice at Perl but am
I am total begineer in ruby so its very novice question. I am trying
Hello javascript experts! I'm a novice here, trying to create a script to add
I am a total cryptography novice and was looking to have a simple (ha!)
Total jQuery novice, so go easy! I have the following jQuery files in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.