$ show doableware/djongo
Djongo is a Django database backend that enables using MongoDB as the database engine without modifying the Django ORM. It translates SQL queries (generated by Django's ORM) into MongoDB aggregation pipelines and commands, and provides custom model fields for embedded documents, arrays, and ObjectIds. The core is a SQL-to-MongoDB compiler implemented in the `sql2mongo/` package, which parses SQL tokens and maps them to MongoDB operators and stages. The repository also includes a commercial documentation site built with Angular and Jekyll, and references a paid cloud service (DjongoCS). The library is in alpha stage, with many features explicitly unsupported (indexes, transactions, schema validation, etc.) and pinned to very old versions of Django (≤3.1.12), pymongo (≤3.11.4), and sqlparse (0.2.4). The codebase shows signs of neglect: use of `print` for warnings, many `raise NotSupportedError` placeholders, and incomplete implementations. While the SQL-to-MongoDB translation logic is conceptually interesting, the overall package is not production-ready for modern Django/MongoDB stacks.
The LLM identified 4 files worth highlighting for reuse:
Core query dispatcher that translates SQL statements (SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) into MongoDB commands and aggregation pipelines. It delegates to specialized query classes and handles subqueries and joins. This is the central piece of the SQL-to-MongoDB compiler and demonstrates a clean pattern for cross-dialect query translation.
Maps SQL operators (comparison, IN, LIKE, regex) to MongoDB operators ($eq, $in, $regex, etc.). Contains `WhereOp`, `InOp`, `LikeOp`, `CmpOp` classes that parse SQL tokens and produce MongoDB filter expressions. This module is self-contained and could be reused in any SQL-to-MongoDB converter.
Implements Django's storage backend using MongoDB GridFS. Provides `GridFSStorage` class that subclasses Django's `Storage` to store and retrieve files in MongoDB. It is a self-contained, reusable component for any Django project needing MongoDB file storage.
Defines custom Django model fields for MongoDB document structures: `EmbeddedField`, `ArrayField`, `ArrayReferenceField`, `ObjectIdField`, `JSONField`, `GenericObjectIdField`. These fields encapsulate the logic for embedding documents, storing arrays, and referencing ObjectIds, including form field integration. They can be extracted for other Django-MongoDB integrations.