Skip to content

Commit a1ff627

Browse files
author
Peng Ren
committed
Unify the format of code
1 parent 5c4b8da commit a1ff627

14 files changed

Lines changed: 1 addition & 112 deletions

pymongosql/executor.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
Query execution strategies for handling both simple and subquery-based SQL operations.
4-
5-
This module provides different execution strategies:
6-
- StandardExecution: Direct MongoDB query for simple SELECT statements
7-
8-
The intermediate database is configurable - any backend implementing QueryDatabase
9-
interface can be used (SQLite3, PostgreSQL, MySQL, etc.).
10-
"""
11-
122
import logging
133
from abc import ABC, abstractmethod
144
from dataclasses import dataclass

pymongosql/sql/builder.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
Query builder for constructing MongoDB queries in a fluent, readable way
4-
"""
52
import logging
63
from dataclasses import dataclass, field
74
from typing import Any, Dict, List, Optional, Union

pymongosql/sql/handler.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
Expression handlers for converting SQL expressions to MongoDB query format
4-
"""
52
import logging
63
import re
74
from abc import ABC, abstractmethod

pymongosql/sqlalchemy_mongodb/__init__.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
SQLAlchemy MongoDB dialect and integration for PyMongoSQL.
4-
5-
This package provides SQLAlchemy integration including:
6-
- MongoDB-specific dialect
7-
- Version compatibility utilities
8-
- Engine creation helpers
9-
- MongoDB URI handling
10-
"""
11-
122
# SQLAlchemy integration
133
try:
144
# Import and register the dialect automatically
@@ -80,11 +70,7 @@ def register_dialect():
8070

8171
# Register for standard MongoDB URLs
8272
registry.register("mongodb", "pymongosql.sqlalchemy_mongodb.sqlalchemy_dialect", "PyMongoSQLDialect")
83-
84-
# Try to register SRV and Superset forms so SQLAlchemy can resolve these URL patterns
85-
# (either with '+' or dotted notation for compatibility with different SQLAlchemy versions).
86-
# Some SQLAlchemy versions accept '+' in scheme names; others import the dotted plugin name.
87-
# Attempt all registrations but don't fail if some are not supported.
73+
# Register for MongoDB SRV URLs
8874
try:
8975
registry.register("mongodb+srv", "pymongosql.sqlalchemy_mongodb.sqlalchemy_dialect", "PyMongoSQLDialect")
9076
registry.register("mongodb.srv", "pymongosql.sqlalchemy_mongodb.sqlalchemy_dialect", "PyMongoSQLDialect")

pymongosql/sqlalchemy_mongodb/sqlalchemy_compat.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
SQLAlchemy version compatibility utilities for PyMongoSQL.
4-
5-
This module provides utilities to work with different SQLAlchemy versions.
6-
"""
72
import warnings
83
from typing import Any, Dict, Optional
94

pymongosql/sqlalchemy_mongodb/sqlalchemy_dialect.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
SQLAlchemy dialect for PyMongoSQL.
4-
5-
This module provides a SQLAlchemy dialect that allows PyMongoSQL to work
6-
seamlessly with SQLAlchemy's ORM and core query functionality.
7-
8-
Supports both SQLAlchemy 1.x and 2.x versions.
9-
"""
102
import logging
113
from typing import Any, Dict, List, Optional, Tuple, Type
124

pymongosql/superset_mongodb/detector.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
Subquery detection and execution context management for handling Superset-style queries.
4-
5-
This module provides utilities to detect and manage the execution context for SQL queries
6-
that contain subqueries, enabling the use of SQLite3 as an intermediate database for
7-
complex query operations that MongoDB cannot handle natively.
8-
"""
9-
102
import re
113
from dataclasses import dataclass
124
from typing import Optional, Tuple

pymongosql/superset_mongodb/executor.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
Query execution strategies for handling both simple and subquery-based SQL operations.
4-
5-
This module provides different execution strategies:
6-
- StandardExecution: Direct MongoDB query for simple SELECT statements
7-
- SubqueryExecution: Two-stage execution using intermediate RDBMS (SQLite3 by default)
8-
9-
The intermediate database is configurable - any backend implementing QueryDatabase
10-
interface can be used (SQLite3, PostgreSQL, MySQL, etc.).
11-
"""
12-
132
import logging
143
from typing import Any, Dict, List, Optional
154

pymongosql/superset_mongodb/query_db.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
Query database abstraction layer.
4-
5-
This module provides an abstract interface for databases used
6-
during subquery execution. Allows plugging in different RDBMS backends
7-
(SQLite3, PostgreSQL, MySQL, etc.) while maintaining a unified interface.
8-
9-
Default implementation uses SQLite3 for in-memory processing.
10-
"""
11-
122
import logging
133
from abc import ABC, abstractmethod
144
from typing import Any, Dict, List

pymongosql/superset_mongodb/query_db_sqlite.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
# -*- coding: utf-8 -*-
2-
"""
3-
SQLite3 bridge for handling query database operations.
4-
5-
This module manages the creation, population, and querying of in-memory SQLite3
6-
databases that serve as an intermediate layer between MongoDB and Superset,
7-
enabling support for complex SQL operations that MongoDB cannot handle natively.
8-
9-
SQLiteBridge is the default implementation of the QueryDatabase interface.
10-
"""
11-
122
import logging
133
import sqlite3
144
from typing import Any, Dict, List, Optional

0 commit comments

Comments
 (0)