Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlalchemy: PostgreSQL - type Text and Integer compatibility #3037

Closed
hachreak opened this issue Apr 20, 2015 · 1 comment · Fixed by #3045
Closed

sqlalchemy: PostgreSQL - type Text and Integer compatibility #3037

hachreak opened this issue Apr 20, 2015 · 1 comment · Fixed by #3045
Assignees
Milestone

Comments

@hachreak
Copy link
Member

PostgreSQL Text type doesn't accept length parameter: http://www.postgresql.org/docs/9.1/static/datatype-character.html

ProgrammingError: (psycopg2.ProgrammingError) type modifier is not allowed for type "text"
LINE 5:  value TEXT(35) NOT NULL,
                ^
[SQL: "\nCREATE TABLE bib00x (\n\tid SERIAL NOT NULL, \n\ttag VARCHAR(6) DEFAULT '' NOT NULL, \n\tvalue TEXT(35) NOT NULL, \n\tPRIMARY KEY (id)\n)\n\n"]

I tried to ask to zzzeek if exists a easy solution to this problem: https://bitbucket.org/zzzeek/sqlalchemy/issue/3370/text-and-length

In alternative, with @jirikuncar, we agree to resolve in the same way as for Integer

@jirikuncar jirikuncar added this to the v2.1 milestone Apr 20, 2015
@jirikuncar jirikuncar changed the title PostgreSQL - type Text compatibility sqlalchemy: PostgreSQL - type Text compatibility Apr 20, 2015
@hachreak
Copy link
Member Author

I found that also Integer give us problems if we use latest version of SQLAlchemy 1.0.0.
zzzeek told me about a solution (maybe applicable also to solve integer problem).

So, summarizing all problems:

hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 21, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (addresses inveniosoftware#3037)

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 21, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (addresses inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 21, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (addresses inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 21, 2015
* Addresses issue with default constructor on types that do not
  accept arguments in SQLAlchemy>=1.0.0. (closes inveniosoftware#3037)

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 22, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (addresses inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 22, 2015
* Changes Integer in models because from SQLAlchemy>=1.0 it's arised a
  exceptions on use LegacyInteger. (closes inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 22, 2015
* Changes Integer in models because from SQLAlchemy>=1.0 it's arised a
  exceptions on use LegacyInteger. (closes inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
@hachreak hachreak changed the title sqlalchemy: PostgreSQL - type Text compatibility sqlalchemy: PostgreSQL - type Text and Integer compatibility Apr 23, 2015
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 23, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (addresses inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 23, 2015
* Changes Integer in models because from SQLAlchemy>=1.0 it's arised a
  exceptions on use LegacyInteger. (closes inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 23, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (addresses inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 23, 2015
* Changes Integer in models because from SQLAlchemy>=1.0 it's arised a
  exceptions on use LegacyInteger. (closes inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>

Conflicts:
	invenio/modules/tags/models.py
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 28, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (addresses inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 28, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 28, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 28, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 28, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 29, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 30, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 30, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* Refactores SbmFORMATEXTENSION and sbmGFILERESULT.

* Removes Invenio hacks on MySQL Index and Primary Key creation.

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 30, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* Adds id column in SbmFORMATEXTENSION and sbmGFILERESULT.

* Removes Invenio hacks on MySQL Index and Primary Key creation.

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 30, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* Adds id column in SbmFORMATEXTENSION and sbmGFILERESULT.

* Removes Invenio hacks on MySQL Index and Primary Key creation.

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue Apr 30, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* Adds id column in SbmFORMATEXTENSION and sbmGFILERESULT.

* Removes Invenio hacks on MySQL Index and Primary Key creation.

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* Adds id column in SbmFORMATEXTENSION and sbmGFILERESULT.

* Removes Invenio hacks on MySQL Index and Primary Key creation.

* Updates minimum Flask-Admin version to 1.1.0.

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* Changes Text in models because from SQLAlchemy>=1.0 it's arised a
  exception if the length is specified. (closes inveniosoftware#3037)

* Adds id column in SbmFORMATEXTENSION and sbmGFILERESULT.

* Removes Invenio hacks on MySQL Index and Primary Key creation.

* Updates minimum Flask-Admin version to 1.1.0.

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* BETTER Improves compatibility of Text fields  in PostrgeSQL by
  changing Text in models and removes Invenio hacks on MySQL Index and
  Primary Key creation because starting from SQLAlchemy>=1.0 it arises
  an exception if the length is specified. (addresses inveniosoftware#3037)

* Updates minimum Flask-Admin version to 1.1.0.

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* Changes Text in models and removes Invenio hacks on MySQL
  Index and Primary Key creation because starting from SQLAlchemy>=1.0
  it arises an exception if the length is specified. (closes inveniosoftware#3037)

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* Changes Text in models because starting from SQLAlchemy>=1.0
  it arises an exception if the length is specified. (closes inveniosoftware#3037)

* Removes a text composed primary keys because SQLAlchemy seems to have
  a issue on this kind of definition. Uses a id as primary key and a
  recipe to upgrade the database to compensate.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* Changes Text in models because starting from SQLAlchemy>=1.0
  it arises an exception if the length is specified. (closes inveniosoftware#3037)

* Adds new column 'id’ with a primary key and implements upgrade recipe
  to modify the tables sbmFORMATEXTENSION and sbmGFILERESULT.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* BETTER Improves compatibility of Text fields  in PostrgeSQL by
  changing Text in models and removes Invenio hacks on MySQL Index and
  Primary Key creation because starting from SQLAlchemy>=1.0 it arises
  an exception if the length is specified. (addresses inveniosoftware#3037)

* Updates minimum Flask-Admin version to 1.1.0.

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* Changes Text in models because starting from SQLAlchemy>=1.0
  it arises an exception if the length is specified. (closes inveniosoftware#3037)

* Adds new column 'id’ with a primary key and implements upgrade recipe
  to modify the tables sbmFORMATEXTENSION and sbmGFILERESULT.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* Changes Text in models because starting from SQLAlchemy>=1.0
  it arises an exception if the length is specified. (closes inveniosoftware#3037)

* Adds new column 'id' with a primary key and implements upgrade recipe
  to modify the tables sbmFORMATEXTENSION and sbmGFILERESULT.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* BETTER Improves compatibility of Text fields in PostrgeSQL by
  changing Text in models and removes Invenio hacks on MySQL Index and
  Primary Key creation because starting from SQLAlchemy>=1.0 it arises
  an exception if the length is specified. (addresses inveniosoftware#3037)

* Updates minimum Flask-Admin version to 1.1.0.

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
hachreak pushed a commit to hachreak/invenio that referenced this issue May 4, 2015
* Changes Text in models because starting from SQLAlchemy>=1.0
  it arises an exception if the length is specified. (closes inveniosoftware#3037)

* Adds new column 'id' with a primary key and implements upgrade recipe
  to modify the tables sbmFORMATEXTENSION and sbmGFILERESULT.

Signed-off-by: Leonardo Rossi <[email protected]>
jmartinm pushed a commit to jmartinm/invenio that referenced this issue Jul 21, 2015
* BETTER Improves compatibility of Text fields in PostrgeSQL by
  changing Text in models and removes Invenio hacks on MySQL Index and
  Primary Key creation because starting from SQLAlchemy>=1.0 it arises
  an exception if the length is specified. (addresses inveniosoftware#3037)

* Updates minimum Flask-Admin version to 1.1.0.

* PEP8/257 code style improvements.

Signed-off-by: Leonardo Rossi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants