kopia lustrzana https://github.com/simonw/datasette
Rename InterruptedError => QueryInterrupted, closes #490
rodzic
edb36629e7
commit
bd4dbc8519
|
@ -26,7 +26,7 @@ from .renderer import json_renderer
|
|||
from .database import Database
|
||||
|
||||
from .utils import (
|
||||
InterruptedError,
|
||||
QueryInterrupted,
|
||||
Results,
|
||||
escape_css_string,
|
||||
escape_sqlite,
|
||||
|
@ -346,7 +346,7 @@ class Datasette:
|
|||
)
|
||||
try:
|
||||
results = await self.execute(database, sql, list(set(values)))
|
||||
except InterruptedError:
|
||||
except QueryInterrupted:
|
||||
pass
|
||||
else:
|
||||
for id, value in results:
|
||||
|
@ -504,7 +504,7 @@ class Datasette:
|
|||
truncated = False
|
||||
except sqlite3.OperationalError as e:
|
||||
if e.args == ("interrupted",):
|
||||
raise InterruptedError(e, sql, params)
|
||||
raise QueryInterrupted(e, sql, params)
|
||||
if log_sql_errors:
|
||||
print(
|
||||
"ERROR: conn={}, sql = {}, params = {}: {}".format(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from pathlib import Path
|
||||
|
||||
from .utils import (
|
||||
InterruptedError,
|
||||
QueryInterrupted,
|
||||
detect_fts,
|
||||
detect_primary_keys,
|
||||
detect_spatialite,
|
||||
|
@ -58,8 +58,8 @@ class Database:
|
|||
).rows[0][0]
|
||||
counts[table] = table_count
|
||||
# In some cases I saw "SQL Logic Error" here in addition to
|
||||
# InterruptedError - so we catch that too:
|
||||
except (InterruptedError, sqlite3.OperationalError):
|
||||
# QueryInterrupted - so we catch that too:
|
||||
except (QueryInterrupted, sqlite3.OperationalError):
|
||||
counts[table] = None
|
||||
if not self.is_mutable:
|
||||
self.cached_table_counts = counts
|
||||
|
|
|
@ -7,7 +7,7 @@ from datasette.utils import (
|
|||
path_with_added_args,
|
||||
path_with_removed_args,
|
||||
detect_json1,
|
||||
InterruptedError,
|
||||
QueryInterrupted,
|
||||
InvalidSql,
|
||||
sqlite3,
|
||||
)
|
||||
|
@ -175,7 +175,7 @@ class ColumnFacet(Facet):
|
|||
),
|
||||
}
|
||||
)
|
||||
except InterruptedError:
|
||||
except QueryInterrupted:
|
||||
continue
|
||||
return suggested_facets
|
||||
|
||||
|
@ -248,7 +248,7 @@ class ColumnFacet(Facet):
|
|||
"selected": selected,
|
||||
}
|
||||
)
|
||||
except InterruptedError:
|
||||
except QueryInterrupted:
|
||||
facets_timed_out.append(column)
|
||||
|
||||
return facet_results, facets_timed_out
|
||||
|
@ -294,7 +294,7 @@ class ArrayFacet(Facet):
|
|||
),
|
||||
}
|
||||
)
|
||||
except (InterruptedError, sqlite3.OperationalError):
|
||||
except (QueryInterrupted, sqlite3.OperationalError):
|
||||
continue
|
||||
return suggested_facets
|
||||
|
||||
|
@ -359,7 +359,7 @@ class ArrayFacet(Facet):
|
|||
"selected": selected,
|
||||
}
|
||||
)
|
||||
except InterruptedError:
|
||||
except QueryInterrupted:
|
||||
facets_timed_out.append(column)
|
||||
|
||||
return facet_results, facets_timed_out
|
||||
|
@ -406,7 +406,7 @@ class DateFacet(Facet):
|
|||
),
|
||||
}
|
||||
)
|
||||
except (InterruptedError, sqlite3.OperationalError):
|
||||
except (QueryInterrupted, sqlite3.OperationalError):
|
||||
continue
|
||||
return suggested_facets
|
||||
|
||||
|
@ -472,7 +472,7 @@ class DateFacet(Facet):
|
|||
"selected": selected,
|
||||
}
|
||||
)
|
||||
except InterruptedError:
|
||||
except QueryInterrupted:
|
||||
facets_timed_out.append(column)
|
||||
|
||||
return facet_results, facets_timed_out
|
||||
|
@ -659,7 +659,7 @@ class ManyToManyFacet(Facet):
|
|||
"selected": selected,
|
||||
}
|
||||
)
|
||||
except InterruptedError:
|
||||
except QueryInterrupted:
|
||||
facets_timed_out.append(destination_table)
|
||||
|
||||
return facet_results, facets_timed_out
|
||||
|
|
|
@ -46,7 +46,7 @@ ENV SQLITE_EXTENSIONS /usr/lib/x86_64-linux-gnu/mod_spatialite.so
|
|||
"""
|
||||
|
||||
|
||||
class InterruptedError(Exception):
|
||||
class QueryInterrupted(Exception):
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ from sanic.views import HTTPMethodView
|
|||
from datasette import __version__
|
||||
from datasette.plugins import pm
|
||||
from datasette.utils import (
|
||||
InterruptedError,
|
||||
QueryInterrupted,
|
||||
InvalidSql,
|
||||
LimitedWriter,
|
||||
format_bytes,
|
||||
|
@ -368,7 +368,7 @@ class BaseView(RenderMixin):
|
|||
|
||||
else:
|
||||
data, extra_template_data, templates = response_or_template_contexts
|
||||
except InterruptedError:
|
||||
except QueryInterrupted:
|
||||
raise DatasetteError(
|
||||
"""
|
||||
SQL query took too long. The time limit is controlled by the
|
||||
|
|
|
@ -9,7 +9,7 @@ from sanic.request import RequestParameters
|
|||
from datasette.plugins import pm
|
||||
from datasette.utils import (
|
||||
CustomRow,
|
||||
InterruptedError,
|
||||
QueryInterrupted,
|
||||
append_querystring,
|
||||
compound_keys_after_sql,
|
||||
escape_sqlite,
|
||||
|
@ -527,7 +527,7 @@ class TableView(RowTableShared):
|
|||
await self.ds.execute(database, count_sql, from_sql_params)
|
||||
)
|
||||
filtered_table_rows_count = count_rows[0][0]
|
||||
except InterruptedError:
|
||||
except QueryInterrupted:
|
||||
pass
|
||||
|
||||
# facets support
|
||||
|
|
|
@ -652,7 +652,7 @@ Each Facet subclass implements a new type of facet operation. The class should l
|
|||
"results": facet_results_values,
|
||||
"truncated": len(facet_rows_results) > facet_size,
|
||||
}
|
||||
except InterruptedError:
|
||||
except QueryInterrupted:
|
||||
facets_timed_out.append(column)
|
||||
|
||||
return facet_results, facets_timed_out
|
||||
|
|
Ładowanie…
Reference in New Issue