-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Rethink approach to [ and ] in column names (currently throws error) #329
Comments
Quoting #86 (comment) in full:
|
So either I do the automatic replacement, or I let the user request automatic replacement, or a third option: I do automatic replacement but let the user opt to receive an error instead. |
Here's the code where this happens: sqlite-utils/sqlite_utils/db.py Lines 2943 to 2948 in 54191d4
It's called from three different methods in |
If I add a new parameter for opting in and out of fixing these, what should it be called? A few options:
|
I'm inclined to just fix them and not have an option for opting-out of fixing them, since it adds quite a bit of cruft to the overall API design for an option that maybe no-one will ever use. |
What are my options for replacing those characters?
|
I think I like the underscore option best. I don't like the idea of injecting surprise
|
I could even have those replacement characters be properties of the class Database:
left_brace_replace = "_"
right_brace_replace = "_"
... |
I'm not going to do this, it's unnecessary extra complexity and it means the function that fixes the column names needs to have access to the current |
If I replace What should the following do? table.insert({"foo[bar]": 4}, pk="foo[bar]", column_order=["foo[bar]"]) Should it spot the old column names in the |
I'm not going to implement a fix that rewrites the |
I was going to replace all of the I'll keep the This avoids the whole issue of needing to rewrite parameters, and solves the immediate problem which is consuming CSV files with bad column names. |
Originally posted by @simonw in simonw/datasette-app#121 (comment)
This is a rethinking of the solution to:
The text was updated successfully, but these errors were encountered: