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

Migrate superset db from sqlite to postgres fails key constraints #2475

Closed
2 of 3 tasks
htruongaff opened this issue Mar 25, 2017 · 4 comments
Closed
2 of 3 tasks

Migrate superset db from sqlite to postgres fails key constraints #2475

htruongaff opened this issue Mar 25, 2017 · 4 comments

Comments

@htruongaff
Copy link

htruongaff commented Mar 25, 2017

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if any
  • I have reproduced the issue with at least the latest released version of superset
  • I have checked the issue tracker for the same issue and I haven't found one similar

Superset version

0.15.4

Expected results

I've previously migrated data from one sqlite to a fresh new sqlite database with no issues. Now when I've ported the raw table data from sqlite into postgres, I get primary key errors when trying to create new tables /slices/dashboards through superset directly post migration. I checked and the primary keys in postgres aren't sequences that need to be reset. So there must be some other indexing happening with superset directly.

Is there a way to reset the index/counters?

I've checked and each attempt to add a table will increment the ID even if it fails. Eventually it works, but fails due to column IDs not incrementing.

Actual results

Steps to reproduce

@kmagida110
Copy link

kmagida110 commented Apr 4, 2017

I am also getting an issue when I attempt to migrate my Postgres with the most recent update. I am getting the following errors when I run superset db migrate. The db is hosted on RDS and was working prior to the migration.

Traceback (most recent call last):
  File "/home/ubuntu/venv/bin/superset", line 15, in <module>
    manager.run()
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/flask_script/__init__.py", line 412, in run
    result = self.handle(sys.argv[0], sys.argv[1:])
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/flask_script/__init__.py", line 383, in handle
    res = handle(*args, **config)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/flask_script/commands.py", line 216, in __call__
    return self.run(*args, **kwargs)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/flask_migrate/__init__.py", line 155, in migrate
    version_path=version_path, rev_id=rev_id)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/alembic/command.py", line 176, in revision
    script_directory.run_env()
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/alembic/script/base.py", line 416, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file
    module = load_module_py(module_id, path)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/alembic/util/compat.py", line 75, in load_module_py
    mod = imp.load_source(module_id, path, fp)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/superset/migrations/env.py", line 100, in <module>
    run_migrations_online()
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/superset/migrations/env.py", line 93, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/alembic/runtime/environment.py", line 817, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/alembic/runtime/migration.py", line 314, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/alembic/command.py", line 156, in retrieve_migrations
    revision_context.run_autogenerate(rev, context)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/alembic/autogenerate/api.py", line 415, in run_autogenerate
    self._run_environment(rev, migration_context, True)
  File "/home/ubuntu/venv/local/lib/python2.7/site-packages/alembic/autogenerate/api.py", line 427, in _run_environment
    raise util.CommandError("Target database is not up to date.")
alembic.util.exc.CommandError: Target database is not up to date.

@xrmx
Copy link
Contributor

xrmx commented Apr 4, 2017

This looks like more of an alembic / flask-migrate issue rather than a superset one

@kmagida110
Copy link

Do you have any tips on how to address it?

@mistercrunch
Copy link
Member

Notice: this issue has been closed because it has been inactive for 383 days. Feel free to comment and request for this issue to be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants