On Mon, Mar 8, 2010 at 12:06 AM, [email protected] <[email protected]> wrote:
> My question - if I want my tables to be able to hold more than 2^32
> entries is the primary key (id) then a bigint? What are the underlying
> limits? If I want an auto-incrementing serial number (which I want to
> keep forever as a transaction id) that can grow beyond 2^32 can elixir
> be told to do that and use the underlying bigserial postgresql serial
> type? What about when I grab the serial number and use it in python,
> is it then a python int or is it a python long?

In Python 2.x, int and long objects can be freely mixed and matched
and Python upgrades ints to longs for you behind the scenes as needed.
You probably don't have to care about the distinction [1]. The maximum
int value is stored in sys.maxint and on 32-bit platforms should be
2^31-1. In Python 3.x there is only one integer type that is
essentially an optimized implementation of the Python 2.x long type.

Elixir uses the SQLAlchemy field types. SQLAlchemy appears to have
built-in field types for most of PostGreSQL's special types [2]
including PGBigInteger for BIGINT. BIGSERIAL appears to be used
automatically if the PGSchemaGenerator finds a PGBigInteger field that
is autoincremented.

[1] Unless there is some code in Elixir that explicitly checks the
type using, e.g., isinstance(x, int).

[2] http://www.sqlalchemy.org/trac/browser/lib/sqlalchemy/databases/postgres.py

Schiavo
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en.

Reply via email to