mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
table_exists() now uses async SQL, refs #420
This commit is contained in:
parent
82fec60481
commit
0209a0a344
5 changed files with 47 additions and 28 deletions
|
|
@ -801,10 +801,11 @@ def get_plugins(pm):
|
|||
FORMATS = ('csv', 'json', 'jsono')
|
||||
|
||||
|
||||
def resolve_table_and_format(table_and_format, table_exists):
|
||||
async def resolve_table_and_format(table_and_format, table_exists):
|
||||
if '.' in table_and_format:
|
||||
# Check if a table exists with this exact name
|
||||
if table_exists(table_and_format):
|
||||
it_exists = await table_exists(table_and_format)
|
||||
if it_exists:
|
||||
return table_and_format, None
|
||||
# Check if table ends with a known format
|
||||
for _format in FORMATS:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue