Note that there are some explanatory texts on larger screens.

plurals
  1. POBigInteger in SQLAlchemy or not?
    text
    copied!<p>I apologize in advance if this is poorly formatted; it's rather late for me.</p> <p>Basically, I'm using Python with SQLAlchemy. I'm trying to map a class to a PostgreSQL DB table using the <a href="http://www.sqlalchemy.org/docs/orm/extensions/declarative.html#synopsis" rel="nofollow">Object Relational Mapper, declarative style</a>.</p> <p>According to <a href="http://www.sqlalchemy.org/docs/core/types.html#generic-types" rel="nofollow">SQLAlchemy's documentation on data types</a>, I should be able to use the type <code>BigInteger</code> to represent potentially large integers in the Database, particularly since I know that <a href="http://www.postgresql.org/docs/8.1/static/datatype.html#DATATYPE-INT" rel="nofollow">PostgreSQL supports the BIGINT data type</a>.</p> <p>So, I attempt to declare my class like so:</p> <pre><code>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 </code></pre> <p>However, when I try to use this file at all, I'm greeted with the following:</p> <pre><code>Traceback (most recent call last): File "sqltest02.py", line 9, in &lt;module&gt; from account import Account File "/home/pdusen/prog/account.py", line 2, in &lt;module&gt; from sqlalchemy import Column, BigInteger, Text, Sequence, Boolean ImportError: cannot import name BigInteger </code></pre> <p>So, according to SQLAlchemy's documentation, the <code>BigInteger</code> type exists, but according to python it does not. Is there something here I'm missing?</p> <p>Thanks in advance for all answers.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload