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

AssertionError: The schema for the "reahl-web-declarative" egg has already been created previously at version 4.0.2 #141

Closed
metaperl opened this issue Oct 19, 2018 · 7 comments

Comments

@metaperl
Copy link
Contributor

When attempting to run the addressbook1 example, I get the following error transcript:

c:\Temp\reahl-examples>reahl example tutorial.addressbook1
Checking out to c:\Temp\reahl-examples\addressbook1
c:\Temp\reahl-examples\addressbook1\.reahlalias
c:\Temp\reahl-examples\addressbook1\.reahlproject
c:\Temp\reahl-examples\addressbook1\addressbook1.py
c:\Temp\reahl-examples\addressbook1\addressbook1_dev\test_addressbook1.py
c:\Temp\reahl-examples\addressbook1\addressbook1_dev\__init__.py
c:\Temp\reahl-examples\addressbook1\etc\web.config.py

c:\Temp\reahl-examples>cd addressbook1

c:\Temp\reahl-examples\addressbook1>reahl setup --develop -N
usage: setup [-h] [-s] [-a] [-S STATES] [-n] [-t TAGS] [-p] [-X] [-d] ...
setup: error: unrecognized arguments: --develop -N

c:\Temp\reahl-examples\addressbook1>reahl setup -- develop -N
running develop
running egg_info
creating addressbook1.egg-info
writing addressbook1.egg-info\PKG-INFO
writing dependency_links to addressbook1.egg-info\dependency_links.txt
writing entry points to addressbook1.egg-info\entry_points.txt
writing namespace_packages to addressbook1.egg-info\namespace_packages.txt
writing requirements to addressbook1.egg-info\requires.txt
writing top-level names to addressbook1.egg-info\top_level.txt
writing manifest file 'addressbook1.egg-info\SOURCES.txt'
reading manifest file 'addressbook1.egg-info\SOURCES.txt'
writing manifest file 'addressbook1.egg-info\SOURCES.txt'
running build_ext
Creating c:\development\lib\site-packages\addressbook1.egg-link (link to .)
Adding addressbook1 0.0 to easy-install.pth file

Installed c:\temp\reahl-examples\addressbook1
Performing post command duties

c:\Temp\reahl-examples\addressbook1>reahl createdbuser etc
WARNING:reahl.component.config:reahlsystem.connection_uri in etc\reahl.config.py is using a dangerous default setting: sqlite:///C:\Users\i2615\AppData\Local\Temp\reahl.db
WARNING:reahl.component.config:reahlsystem.debug in etc\reahl.config.py is using a dangerous default setting: True
WARNING:reahl.component.config:reahlsystem.root_egg in etc\reahl.config.py is using a dangerous default setting: addressbook1
WARNING:reahl.component.config:web.default_http_port in etc\web.config.py is using a dangerous default setting: 8000
WARNING:reahl.component.config:web.encrypted_http_port in etc\web.config.py is using a dangerous default setting: 8363
WARNING:reahl.component.config:web.static_root in etc\web.config.py is using a dangerous default setting: c:\Temp\reahl-examples\addressbook1

c:\Temp\reahl-examples\addressbook1>reahl createdb etc
WARNING:reahl.component.config:reahlsystem.connection_uri in etc\reahl.config.py is using a dangerous default setting: sqlite:///C:\Users\i2615\AppData\Local\Temp\reahl.db
WARNING:reahl.component.config:reahlsystem.debug in etc\reahl.config.py is using a dangerous default setting: True
WARNING:reahl.component.config:reahlsystem.root_egg in etc\reahl.config.py is using a dangerous default setting: addressbook1
WARNING:reahl.component.config:web.default_http_port in etc\web.config.py is using a dangerous default setting: 8000
WARNING:reahl.component.config:web.encrypted_http_port in etc\web.config.py is using a dangerous default setting: 8363
WARNING:reahl.component.config:web.static_root in etc\web.config.py is using a dangerous default setting: c:\Temp\reahl-examples\addressbook1

c:\Temp\reahl-examples\addressbook1>reahl createdbtables etc
WARNING:reahl.component.config:reahlsystem.connection_uri in etc\reahl.config.py is using a dangerous default setting: sqlite:///C:\Users\i2615\AppData\Local\Temp\reahl.db
WARNING:reahl.component.config:reahlsystem.debug in etc\reahl.config.py is using a dangerous default setting: True
WARNING:reahl.component.config:reahlsystem.root_egg in etc\reahl.config.py is using a dangerous default setting: addressbook1
WARNING:reahl.component.config:web.default_http_port in etc\web.config.py is using a dangerous default setting: 8000
WARNING:reahl.component.config:web.encrypted_http_port in etc\web.config.py is using a dangerous default setting: 8363
WARNING:reahl.component.config:web.static_root in etc\web.config.py is using a dangerous default setting: c:\Temp\reahl-examples\addressbook1
Traceback (most recent call last):
  File "c:\development\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\development\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\Development\Scripts\reahl.exe\__main__.py", line 9, in <module>
  File "c:\development\lib\site-packages\reahl\component\shelltools.py", line 208, in execute_one
    result = cls().do(sys.argv[1:])
  File "c:\development\lib\site-packages\reahl\component\shelltools.py", line 110, in do
    return self.execute(args)
  File "c:\development\lib\site-packages\reahl\component\shelltools.py", line 234, in execute
    return super(ReahlCommandline, self).execute(args)
  File "c:\development\lib\site-packages\reahl\component\shelltools.py", line 169, in execute
    return command.do(args.command_args)
  File "c:\development\lib\site-packages\reahl\component\shelltools.py", line 110, in do
    return self.execute(args)
  File "c:\development\lib\site-packages\reahl\commands\prodshell.py", line 250, in execute
    return self.sys_control.create_db_tables()
  File "c:\development\lib\site-packages\reahl\component\dbutils.py", line 143, in create_db_tables
    return self.orm_control.create_db_tables(transaction, eggs_in_order)
  File "c:\development\lib\site-packages\reahl\sqlalchemysupport\sqlalchemysupport.py", line 321, in create_db_tables
    self.initialise_schema_version_for(egg)
  File "c:\development\lib\site-packages\reahl\sqlalchemysupport\sqlalchemysupport.py", line 345, in initialise_schema_version_for
    (egg_name, existing_versions.one().version)
AssertionError: The schema for the "reahl-web-declarative" egg has already been created previously at version 4.0.2

c:\Temp\reahl-examples\addressbook1>


@metaperl
Copy link
Contributor Author

The easy way to fix this is to use a different database for each application...

Now to figure out how to configure what database reahl uses...

@metaperl
Copy link
Contributor Author

I could not figure out how to configure what database reahl uses... so I used reahl dropdb etc to get rid of the old database.

@craig-reahl
Copy link
Member

It would be the best to drop it, as reahl needs its own tables per application. The error you got when creating the tables for you second application is caused by the createdbtables wanting to create the reahl required tables again, as the default database is the same for both of you applications.

To see which config you have, assuming you have an etc directory like in the examples:

reahl listconfig -v etc

you should note that the output of the command would provide you with a hint(I'm running linux):

WARNING:reahl.component.config:reahlsystem.connection_uri in etc/reahl.config.py is using a dangerous default setting: sqlite:////tmp/reahl.db

To create a different database for your application, you need to create a config file to specifiy it. Create or edit a file in the etc directory called reahl.config.py. Add the follwing to it, or whatever will work for your windows machine:

reahlsystem.connection_uri = 'sqlite:////tmp/test.db'

Remember to run:

reahl createdbtables etc

More database connection examples can be found here:

from reahl.sqlalchemysupport import SqlAlchemyControl

reahlsystem.root_egg = 'reahl-web'
reahlsystem.connection_uri = 'postgresql:///reahl'
#reahlsystem.connection_uri = 'mysql:///reahl'
#reahlsystem.connection_uri = 'sqlite:////tmp/test.db'
#reahlsystem.connection_uri = 'sqlite:///:memory:'
reahlsystem.orm_control = SqlAlchemyControl(echo=False)

@IwanVosloo
Copy link
Member

The thing that is perhaps confusing here is that we print a stacktrace. We do this a lot.

A better interface would be to always catch errors we know can happen and report them to the user in words a user can understand... so that stacktrace would mean "there's something seriously broken" instead.

We have built a bit of infrastructure to do this reporting better. If you thrown a DomainException instead of an arbitrary one. See: https://github.com/reahl/reahl/blob/master/reahl-component/reahl/component/shelltools.py#L204

Perhaps we can create a few "beginner" tasks for handing such exceptions better by throwing DomainExceptions with more useful messages

@metaperl
Copy link
Contributor Author

metaperl commented Oct 24, 2018 via email

@IwanVosloo
Copy link
Member

I hear you. We can word it differently, thanks!

@IwanVosloo
Copy link
Member

I have created issues #161 and #162 to deal with what came out of this discussion.

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

3 participants