Hi there -
the length that's in your String() type is not used by SQLAlchemy except
when it first renders DDL for CREATE TABLE, so to that extent it is safe
for the database column itself to be of a different size. This
wouldn't account for something like a client-side validation rule that
makes use of this value, but it sounds like you don't have anything like
that in place.
you of course would want to update your source code with the correct
number so that it documents the actual size but there's no urgency to
having this deployed on production.
On 04/05/2017 06:16 AM, Dave wrote:
Hello,
I have an application that is throwing exceptions on insert because one
of the columns was defined too short.
sqlalchemy.exc.DataError: (psycopg2.DataError) value too long for type
character varying(50)
The model is defined as:
class Device(Base):
processor = Column(String(50))
...
Temporarily, I was thinking on increasing the length by running the
statement:
ALTER TABLE devices ALTER COLUMN processor TYPE character varying(128);
Are there any foreseeable issues with the column definition and the
actual database having different length fields?
The application consists of:
- Pyramid 1.5.
- Postgres 9.3.4.
- SQLAlchemy 1.0.6
- Python 3.4.3
Any thoughts or help would be much appreciated.
Kind Regards,
David Anderson
--
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 [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.