-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from mrchrisadams/ca-issue-19-double-quote-fal…
…lback Add fallback exception when double quotes are used - see issue #19
- Loading branch information
Showing
4 changed files
with
98 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This configuration file was automatically generated by Gitpod. | ||
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) | ||
# and commit this file to your remote git repository to share the goodness with others. | ||
|
||
# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart | ||
|
||
tasks: | ||
- name: Set up environment for development | ||
init: | | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install -e '.[test]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
class DoubleQuoteForLiteraValue(Exception): | ||
""" | ||
DuckDB follows the SQL standard more closely than SQLite, | ||
and as a result, is stricter about the use of double quotes | ||
to wrap literal values. | ||
Thrown when a literal value to compare against is wrapped in | ||
double quotes instead of single quotes. | ||
For more info see the sqlite docs: | ||
https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted | ||
""" | ||
def __init__(self, matches, message=None): | ||
if message: | ||
self.message = message | ||
else: | ||
self.message = ( | ||
"It looks like you are using a double quoted string " | ||
f"for a value at: {matches[0]}. " | ||
"To make this work with DuckDB, wrap it in single quoted " | ||
"strings instead." | ||
) | ||
super().__init__(matches) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters