-
Notifications
You must be signed in to change notification settings - Fork 348
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
fails to display table with foreign keys #42
Comments
Is there any table that has a foreign key to sample? |
Looking more closely it looks like you have a table named expression that has a foreign key to sample. Can you share the full schema? You can do this by opening sqlite shell and running ".schema" at the prompt. |
yes, there is create table expression(sample varchar(80)
, gene_symbol varchar(40)
, tpm double
, log2_tpm double
, PRIMARY KEY (sample, gene_symbol)
, FOREIGN KEY (gene_symbol) references gene(gene_symbol)
, FOREIGN KEY (sample) references sample(sample)) But the error occurs also when I click on |
Ah, actually I just noticed:
|
Are you using sqlite-web to load data? What do you mean "generated"? I'd like to be able to reproduce the issue. |
by "generating" I mean executing the To load data, I use an R script, although the issue occured also when the tables were still empty. (at least sample and expression were empty). |
Cool. Can you share the queries you executed? So I can replicate the issue. |
I don't have time right now, but I will try to set-up a full reproducible example during the next week. |
I'm going to close this and will re-open after you've commented. You will still be able to comment when you have time, even though it's closed. I'll reopen it at that point. |
Here we go! Steps to reproduce.
|
Traceback: Traceback (most recent call last):
File "/home/charles/pypath/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/home/charles/pypath/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/charles/pypath/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/charles/pypath/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/home/charles/pypath/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "./sqlite_web.py", line 202, in inner
return fn(table, *args, **kwargs)
File "./sqlite_web.py", line 218, in table_structure
ds_table = dataset[table]
File "/home/charles/pypath/playhouse/dataset.py", line 63, in __getitem__
self.update_cache(table)
File "/home/charles/pypath/playhouse/dataset.py", line 92, in update_cache
literal_column_names=True)
File "/home/charles/pypath/playhouse/reflection.py", line 598, in generate_models
literal_column_names=literal_column_names)
File "/home/charles/pypath/playhouse/reflection.py", line 586, in introspect
related_name=related_names.get(src))
File "/home/charles/pypath/playhouse/reflection.py", line 120, in set_foreign_key
self.rel_model = model_names[foreign_key.dest_table]
KeyError: u'gene' After restarting the application, the table loads up fine, so this looks to be a cache-invalidation type of issue. |
The fix involved ensuring that dependent tables are specified when updating the cache with a newly-added table. This is fixed in peewee master branch. I will push a new release (will be 3.3.4) shortly. |
Using the latest version from pip, I have the following issue:
When I click on a table that contains a foreign key, an Internal Server Error is caused with the following Traceback:
The SQL of the table looks like
The SQL of the referenced tables like
The text was updated successfully, but these errors were encountered: