Ticket #1116 (new defect)

Opened 2 years ago

Last modified 20 months ago

TypeError: cannot concatenate 'str' and 'int' objects

Reported by: anonymous Owned by: andrew
Priority: minor Milestone: 1.0
Component: commands Version: 0.7.5
Keywords: Cc:

Description

While going through the tutorial (http://south.readthedocs.org/en/latest/tutorial/part1.html) and running the "0002_autoadd_field_knight_dances_whenever_able" migration I get the following error:

  File "/tmp/South-0.7.5/south/db/sqlite3.py", line 79, in _remake_table
    type += " DEFAULT " + column_info['dflt_value']
TypeError: cannot concatenate 'str' and 'int' objects

The column_infodflt_value? returns the int zero which should probably be converted to a str().

Full stack trace:

$> python2.6 ./manage.py migrate southtut
Running migrations for southtut:
 - Migrating forwards to 0002_auto__add_field_knight_dances_whenever_able.
 > southtut:0002_auto__add_field_knight_dances_whenever_able
 ! Error found during real run of migration! Aborting.

 ! Since you have a database that does not support running
 ! schema-altering statements in transactions, we have had
 ! to leave it in an interim state between migrations.

! You *might* be able to recover with:
 ! The South developers regret this has happened, and would
 ! like to gently persuade you to consider a slightly
 ! easier-to-deal-with DBMS (one that supports DDL transactions)
 ! NOTE: The error which caused the migration to fail is further up.
Error in migration: southtut:0002_auto__add_field_knight_dances_whenever_able
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/tmp/Django-1.4/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/tmp/Django-1.4/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/tmp/Django-1.4/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/tmp/Django-1.4/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/tmp/South-0.7.5/south/management/commands/migrate.py", line 107, in handle
    ignore_ghosts = ignore_ghosts,
  File "/tmp/South-0.7.5/south/migration/__init__.py", line 219, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/tmp/South-0.7.5/south/migration/migrators.py", line 235, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/tmp/South-0.7.5/south/migration/migrators.py", line 310, in migrate_many
    result = self.migrate(migration, database)
  File "/tmp/South-0.7.5/south/migration/migrators.py", line 133, in migrate
    result = self.run(migration)
  File "/tmp/South-0.7.5/south/migration/migrators.py", line 107, in run
    return self.run_migration(migration)
  File "/tmp/South-0.7.5/south/migration/migrators.py", line 81, in run_migration
    migration_function()
  File "/tmp/South-0.7.5/south/migration/migrators.py", line 57, in <lambda>
    return (lambda: direction(orm))
  File "/gpfs/scratch05/data/tmp/portal/southtut/migrations/0002_auto__add_field_knight_dances_whenever_able.py", line 14, in forwards
    keep_default=False)
  File "/tmp/South-0.7.5/south/db/sqlite3.py", line 31, in add_column
    field.column: self._column_sql_for_create(table_name, name, field, False),
  File "/tmp/South-0.7.5/south/db/generic.py", line 44, in _cache_clear

    return func(self, table, *args, **opts)
  File "/tmp/South-0.7.5/south/db/sqlite3.py", line 79, in _remake_table
    type += " DEFAULT " + column_info['dflt_value']
TypeError: cannot concatenate 'str' and 'int' objects

Change History

comment:1 Changed 2 years ago by andrew

  • Milestone set to 1.0

Indeed - what version of SQLite and Django are you using? I think their behaviour regarding defaults may have changed.

comment:2 Changed 2 years ago by anonymous

I'm using Django 1.4 and SQLite 3.3.6.

comment:3 follow-up: ↓ 4 Changed 2 years ago by sax <s.apostolico@…>

just some extra info,

Django 1.4/sqlite 3.7.13/CentOS 5.5 FAIL
Django 1.4/sqlite 3.3.6/CentOS 5.5 FAIL

Django 1.4/sqlite 3.7.7/Mint 12 SUCCESS

comment:4 in reply to: ↑ 3 Changed 2 years ago by sax <s.apostolico@…>

Replying to sax <s.apostolico@…>:

just some extra info,

Django 1.4/sqlite 3.7.13/CentOS 5.5 FAIL
Django 1.4/sqlite 3.3.6/CentOS 5.5 FAIL

Django 1.4/sqlite 3.7.7/Mint 12 SUCCESS

Fixed after recompiling python with the updated sqlite version (3.7.13).

comment:5 Changed 20 months ago by aron@…

I patched south to use str(column_info['dflt_value']) to work around this problem on webfaction.

Note: See TracTickets for help on using tickets.