datasette icon indicating copy to clipboard operation
datasette copied to clipboard

Configuration directory mode does not pick up other file extensions than .db

Open dnsos opened this issue 2 years ago • 2 comments

Hello, I've been trying to run Datasette with the configuration directory mode with a structure such as this one:

some-directory/
    example.sqlite3
    another-example.db
    one-more.custom
    [...]

(In my scenario I can't just change the filename extension without other problems arising)

Now databases with the .sqlite3 or the custom filename extension are ignored by Datasette in this case. I'm aware that the docs state that a .db extension is required, but I was wondering if there is a reason for restricting this or any workaround available? When I run datasette example.sqlite3 or datasette one-more.custom the databases are served by Datasette without a problem.

dnsos avatar Mar 02 '22 13:03 dnsos

I'm affected by this as well. Would be nice to be able to pass in an extension, eg --extension=sqlite3.

mustafa0x avatar Jul 02 '22 17:07 mustafa0x

Adding .sqlite3 to this feature makes sense to me.

I don't think it's worth having a --extensión option - it's possible right now to write a Datasette plugin that loads additional databases on startup, there's an example of how to do that in the source code for https://github.com/simonw/datasette-upload-dbs

Here: https://github.com/simonw/datasette-upload-dbs/blob/81510ef4f0004371a3adda18100936b430535cc1/datasette_upload_dbs/init.py#L41-L50

simonw avatar Jul 02 '22 22:07 simonw

Updated documentation: https://docs.datasette.io/en/latest/settings.html#configuration-directory-mode

simonw avatar Oct 07 '22 23:10 simonw