Code Monkey home page Code Monkey logo

Comments (12)

coleifer avatar coleifer commented on May 22, 2024 1

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.

from sqlite-web.

coleifer avatar coleifer commented on May 22, 2024

Is there any table that has a foreign key to sample?

from sqlite-web.

coleifer avatar coleifer commented on May 22, 2024

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.

from sqlite-web.

grst avatar grst commented on May 22, 2024

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 expression and there is no table referencing expression.

from sqlite-web.

grst avatar grst commented on May 22, 2024

Ah, actually I just noticed:

  • at the time the error occured, expression was not yet generated
  • now, as expression exists, I can click on sample without error.
  • Clicking on expression still produces the error (there is no table referencing expression)

from sqlite-web.

coleifer avatar coleifer commented on May 22, 2024

Are you using sqlite-web to load data? What do you mean "generated"?

I'd like to be able to reproduce the issue.

from sqlite-web.

grst avatar grst commented on May 22, 2024

by "generating" I mean executing the create table in the sqlite-web query interface.

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).

from sqlite-web.

coleifer avatar coleifer commented on May 22, 2024

Cool. Can you share the queries you executed? So I can replicate the issue.

from sqlite-web.

grst avatar grst commented on May 22, 2024

I don't have time right now, but I will try to set-up a full reproducible example during the next week.

from sqlite-web.

coleifer avatar coleifer commented on May 22, 2024

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.

from sqlite-web.

grst avatar grst commented on May 22, 2024

Here we go!

Steps to reproduce.

  1. I created a clean environment using anaconda
conda create -n sqlite-web-test
source activate sqlite-web-test
pip install sqlite-web
python --version
Python 3.6.5 :: Anaconda custom (64-bit)
  1. create a database with a single table
sqlite3 test.sqlite "create table gene(gene_symbol varchar(40) primary key);"
  1. run sqlite-web
sqlite_web test.sqlite
  1. open the web interface, click on the gene table. Click on Query.

  2. create the table using Query in the web interface.

create table expression(sample varchar(80)
, gene_symbol varchar(40)
, tpm double
, foreign key (gene_symbol) references gene(gene_symbol))
  1. click on the expression table. Experience an Internal Server Error.

from sqlite-web.

coleifer avatar coleifer commented on May 22, 2024

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.

from sqlite-web.

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.