I want to add a record into the database, but the compiler returns me the 
error. I searched similar problems and I couldn't find the solution.
    
    class Packages(Base):
       __tablename__ = "packages"

       id_package = Column(Integer, primary_key=True)
       name_of_package = Column(String)
       price = Column(Integer)

       def __init__(self, name_of_package, price):
          self.name_of_package = name_of_package
          self.price = price

And then I am inserting the record.

    package = Packages('Economy', 5000)
    session.add(package)

I've missed `id_package`, because it is Primary Key. I receive the 
following error.

> Exception has occurred: TypeError  
> id() takes exactly one argument (0 given)  
> File "C:\***\<string>", line 2, in __ init __  
File "C:\***\module.py", line 135, in <module>  
package = Packages('Economy', 5000)

Line 2 = `from sqlalchemy import Column, Date, Integer, String`

Any ideas?



-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to