1. Andrew Davison
  2. sumatra
  3. Issues

Issues

Issue #187 resolved

smt configure --store=... is broken with postgres

Anonymous created an issue

The following script breaks

#!/bin/bash

\rm -rf Data
\rm -rf .smt
\rm -rf .git
\rm -rf script.py

mkdir Data
echo "print 'running simulation'" > script.py
git init
git add script.py
git ci -m "First commit"
smt init smt_sqlite_to_postgres_test
smt configure --executable=python --main=script.py
smt configure --addlabel=cmdline
smt configure -g uuid
smt run
smt configure --store=postgres://user:password@localhost/database

with

Initialized empty Git repository in /home/wd15/git/tmp_sumatra/smt_sqlite_to_postgres/.git/
[master (root-commit) ebb937e] First commit
 1 file changed, 1 insertion(+)
 create mode 100644 script.py
Sumatra project successfully set up
Multiple versions found, using /home/wd15/.virtualenvs/default/bin/python. If you wish to use a different version, please specify it explicitly
running simulation
No data produced.
Created Django record store using SQLite
Created Django record store using PostgreSQL
Traceback (most recent call last):
  File "/home/wd15/.virtualenvs/default/bin/smt", line 7, in <module>
    execfile(__file__)
  File "/home/wd15/hg/sumatra/bin/smt", line 31, in <module>
    main(sys.argv[2:])
  File "/home/wd15/hg/sumatra/sumatra/commands.py", line 235, in configure
    new_store.sync(old_store, project.name)
  File "/home/wd15/hg/sumatra/sumatra/recordstore/base.py", line 90, in sync
    self.save(project_name, other.get(project_name, label))
  File "/home/wd15/hg/sumatra/sumatra/recordstore/django_store/__init__.py", line 202, in save
    db_record.save() # need to save before using many-to-many relationship
  File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 463, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/usr/lib/python2.7/dist-packages/django/db/models/base.py", line 555, in save_base
    transaction.commit_unless_managed(using=using)
  File "/usr/lib/python2.7/dist-packages/django/db/transaction.py", line 135, in commit_unless_managed
    connection.commit_unless_managed()
  File "/usr/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 214, in commit_unless_managed
    self._commit()
  File "/usr/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 235, in _commit
    return self.connection.commit()
django.db.utils.IntegrityError: insert or update on table "django_store_record" violates foreign key constraint "django_store_record_project_id_fkey"
DETAIL:  Key (project_id)=(smt_sqlite_to_postgres7) is not present in table "django_store_project".

Comments (3)

  1. Log in to comment