Skip to content

Commit 1c76e22

Browse files
authored
0.4.0 - Fixed bugs (#15)
* Bump to 0.4.0 version * Fix reserved keyword issue --------- Co-authored-by: Peng Ren
1 parent 503233d commit 1c76e22

8 files changed

Lines changed: 237 additions & 49 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
[![codecov](https://codecov.io/gh/passren/PyMongoSQL/branch/main/graph/badge.svg?token=2CTRL80NP2)](https://codecov.io/gh/passren/PyMongoSQL)
77
[![License: MIT](https://img.shields.io/badge/License-MIT-purple.svg)](https://github.com/passren/PyMongoSQL/blob/0.1.2/LICENSE)
88
[![Python Version](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
9+
[![Downloads](https://static.pepy.tech/badge/pymongosql/month)](https://pepy.tech/projects/pymongosql)
910
[![MongoDB](https://img.shields.io/badge/MongoDB-7.0+-green.svg)](https://www.mongodb.com/)
1011
[![SQLAlchemy](https://img.shields.io/badge/SQLAlchemy-1.4+_2.0+-darkgreen.svg)](https://www.sqlalchemy.org/)
1112
[![Superset](https://img.shields.io/badge/Apache_Superset-1.0+-blue.svg)](https://superset.apache.org/docs/6.0.0/configuration/databases)
@@ -229,7 +230,7 @@ Parameters are substituted into the MongoDB filter during execution, providing p
229230
- **Array access**: `items[0].name`, `orders[1].total`
230231
- **Complex queries**: `WHERE customer.profile.age > 18 AND orders[0].status = 'paid'`
231232

232-
> **Note**: Avoid SQL reserved words (`user`, `data`, `value`, `count`, etc.) as unquoted field names. Use alternatives or bracket notation for arrays.
233+
> **Note**: Avoid SQL reserved words (`user`, `data`, `value`, `count`, etc.) as unquoted field names. Use alternatives names, or wrap them in double quotes if you must use them.
233234
234235
### Sorting and Limiting
235236

pymongosql/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
if TYPE_CHECKING:
77
from .connection import Connection
88

9-
__version__: str = "0.3.4"
9+
__version__: str = "0.4.0"
1010

1111
# Globals https://www.python.org/dev/peps/pep-0249/#globals
1212
apilevel: str = "2.0"

pymongosql/sql/handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def normalize_field_path(path: str) -> str:
6262
s = re.sub(r"\[\s*['\"]([^'\"]+)['\"]\s*\]", r".\1", s)
6363
# Convert numeric bracket indexes [0] -> .0
6464
s = re.sub(r"\[\s*(\d+)\s*\]", r".\1", s)
65+
# Unquote quoted identifiers in dot notation (e.g., "date" -> date)
66+
s = re.sub(r'"([^"]+)"', r"\1", s)
6567
# Collapse multiple dots and strip leading/trailing dots
6668
s = re.sub(r"\.{2,}", ".", s).strip(".")
6769
return s

0 commit comments

Comments
 (0)