KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I apologize in advance if this is poorly formatted; it's rather late for me. Basically, I'm using Python with SQLAlchemy. I'm trying to map a class to a PostgreSQL DB table using the Object Relational Mapper, declarative style . According to SQLAlchemy's documentation on data types , I should be able to use the type BigInteger to represent potentially large integers in the Database, particularly since I know that PostgreSQL supports the BIGINT data type . So, I attempt to declare my class like so: import sqlalchemy from sqlalchemy import Column, BigInteger, Text, Sequence, Boolean from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Account(Base): __tablename__ = 'accounts' __metadata__ = Base.metadata id = Column(BigInteger, Sequence('id_seq'), unique=True, nullable=False) email = Column(Text(32), unique=True, nullable=False) def __init__(self, email): self.email = email However, when I try to use this file at all, I'm greeted with the following: Traceback (most recent call last): File "sqltest02.py", line 9, in <module> from account import Account File "/home/pdusen/prog/account.py", line 2, in <module> from sqlalchemy import Column, BigInteger, Text, Sequence, Boolean ImportError: cannot import name BigInteger So, according to SQLAlchemy's documentation, the BigInteger type exists, but according to python it does not. Is there something here I'm missing? Thanks in advance for all answers.
Tags (comma-separated)
Save Edits
Cancel