Skip to content

Commit 67725cd

Browse files
committed
fix mypy - add additional test for next already solved issue
1 parent 9ce3bdd commit 67725cd

3 files changed

Lines changed: 28 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ make format # Run ruff formatter
112112
poetry run ruff format .
113113
```
114114

115+
### Type Checking
116+
```bash
117+
poetry run mypy sql_metadata
118+
```
119+
115120
### Coverage
116121
```bash
117122
make coverage # Run tests with coverage report
@@ -120,6 +125,14 @@ poetry run pytest -vv --cov=sql_metadata --cov-report=term-missing
120125

121126
**Important:** The project has a 100% test coverage requirement (`fail_under = 100` in pyproject.toml).
122127

128+
### Verification after changes
129+
After making code changes, always run all three checks:
130+
```bash
131+
poetry run pytest -vv --cov=sql_metadata --cov-report=term-missing # tests + coverage
132+
poetry run mypy sql_metadata # type checking
133+
poetry run ruff check sql_metadata # linting
134+
```
135+
123136
## Code Quality Standards
124137

125138
### Ruff Configuration (pyproject.toml)

sql_metadata/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __init__(self, sql: str = "", disable_logging: bool = False) -> None:
7474
self._output_columns: Optional[list] = None
7575

7676
self._values: Optional[List] = None
77-
self._values_dict: Optional[Dict[str, Union[int, float, str]]] = None
77+
self._values_dict: Optional[Dict[str, Union[int, float, str, list]]] = None
7878

7979
# -------------------------------------------------------------------
8080
# NestedResolver access

test/test_create_table.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,20 @@ def test_ctas_with_redshift_distkey_sortkey():
202202
assert p.columns == ["col1", "col2", "col3"]
203203

204204

205+
def test_create_table_mysql_charset_and_collate():
206+
# Solved: https://github.com/macbre/sql-metadata/issues/358
207+
p = Parser("""CREATE TABLE `jeecg_order_main` (
208+
`id` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
209+
`order_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
210+
`order_date` datetime NULL DEFAULT NULL,
211+
`order_money` double(10, 3) NULL DEFAULT NULL,
212+
`bpm_status` varchar(3) CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
213+
PRIMARY KEY (`id`) USING BTREE
214+
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci""")
215+
assert p.tables == ["jeecg_order_main"]
216+
assert p.columns == ["id", "order_code", "order_date", "order_money", "bpm_status"]
217+
218+
205219
def test_create_table_with_comments_and_keyword_columns():
206220
# Solved: https://github.com/macbre/sql-metadata/issues/507
207221
p = Parser("""

0 commit comments

Comments
 (0)