Coder Social home page Coder Social logo

Comments (3)

ramonakira avatar ramonakira commented on August 19, 2024

Apparently Postgresql needs database-names escaped when they contain "-". And, apparently sqlalchemy does not do this automatically.

If I add database = '%s%s%s' % ('"', database, '"') to def remove_database() in operations.py, things are working for me again. Do you know of any way to maybe using configuration tell Sqlalchemy to escape databasenames?

from stellar.

mikeywaites avatar mikeywaites commented on August 19, 2024

Hey, I'm also seeing this issue with subsequent restore calls.

Traceback (most recent call last):
  File "/usr/local/bin/stellar", line 11, in <module>
    load_entry_point('stellar==0.4.3', 'console_scripts', 'stellar')()
  File "/usr/local/lib/python2.7/site-packages/stellar/command.py", line 279, in main
    stellar()
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/stellar/command.py", line 126, in restore
    app.inline_slave_copy(snapshot)
  File "/usr/local/lib/python2.7/site-packages/stellar/app.py", line 198, in inline_slave_copy
    table.get_table_name('slave')
  File "/usr/local/lib/python2.7/site-packages/stellar/operations.py", line 65, in copy_database
    from_database
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 906, in execute
    return self._execute_text(object, multiparams, params)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1054, in _execute_text
    statement, parameters
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
    context)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
    context)
  File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) database "stellar_cb87a70f797de380" already exists
 [SQL: '\n                CREATE DATABASE "stellar_cb87a70f797de380" WITH TEMPLATE "stellar_486d7ebb93677a14";\n

I'm sure when testing this earlier in the week i was able to call restore multiple times without any issue :/

Update: re-creating the snapshot and removing the old ones seem to have resolved the issue. Perhaps it's possible that the stellar_data table got in a weird state or something ? Will leave this here in case you want to pick this up.

Update 2: Issue has resurfaced already :/ I'll see if i can find a way to consistently re-produce this error.

from stellar.

kiview avatar kiview commented on August 19, 2024

I'm seeing the same problem on PostgreSQl 9.6.11 running inside a Docker container.

In my case, this seems to be caused by #62.

from stellar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.