Skip to content
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

UI to select name of table at time of upload #17

Closed
simonw opened this issue Dec 18, 2020 · 6 comments
Closed

UI to select name of table at time of upload #17

simonw opened this issue Dec 18, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Dec 18, 2020

Picking a better name for the new table is too common a requirement to leave to other plugins such as https://github.com/simonw/datasette-edit-schema

@simonw simonw added the enhancement New feature or request label Dec 18, 2020
@simonw
Copy link
Owner Author

simonw commented Sep 7, 2022

I'm going to have a table name field which will be auto-populated when the user selects a file - but that the user can edit themselves.

If the filename matches an already-existing table I'll add a _2 suffix or similar.

@simonw
Copy link
Owner Author

simonw commented Sep 7, 2022

Here's the current filename code - note that it will over-write an existing table with the same name, which isn't ideal either:

# csv.file is a SpooledTemporaryFile. csv.filename is the filename
filename = csv.filename
if filename.endswith(".csv"):
filename = filename[:-4]

@simonw
Copy link
Owner Author

simonw commented Sep 7, 2022

Right now the upload happens the moment you drop a file onto the drop zone.

I'm going to change that so you now have to do that and THEN click upload, in order to give you time to confirm that the filename for the table is what you want.

@simonw
Copy link
Owner Author

simonw commented Sep 8, 2022

Work in progress, new form looks like this:

image

@simonw
Copy link
Owner Author

simonw commented Sep 8, 2022

Oops, tests fail in Datasette 0.62 but pass in Datasette 0.61.

@simonw
Copy link
Owner Author

simonw commented Sep 8, 2022

Should I bump the minimum required version of Datasette to 0.62?

That's only going to be necessary for the tests to pass, not for the plugin to actually work. So I'm going to leave it.

@simonw simonw closed this as completed in 07ee34c Sep 8, 2022
simonw added a commit that referenced this issue Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant