-
-
Notifications
You must be signed in to change notification settings - Fork 9
Data Import & NoSQL Queries
Lukatrum edited this page May 15, 2026
·
8 revisions
This wiki page outlines the data import methods and NoSQL querying capabilities available in JDb.
The JDb object supports importing data from various formats and relational databases.
You can load configurations directly from INI or TOML formats:
-
INI: Use
jdb.from_ini()to parse INI data. -
TOML: Use
jdb.from_toml()to parse TOML data.
Data from SQLite databases can be migrated using jdb.from_sqlite(db_path).
- Each table in the SQLite database is automatically converted into a specific group within
JDb. - For example, you can access the imported
projectstable usingjdb.get_group('projects')orjdb['projects'].
The find() method provides robust, MongoDB-style NoSQL querying capabilities to filter your JSON data.
-
Exact Match: Use the
ANYparameter, such asjdb.find(ANY={'name': 'Alice'})orjdb.find(ANY='Alice'). -
Regular Expressions: Use the
valsorREparameters for regex matching, such asjdb.find(vals={'name': r'li[a-z]'})orjdb.find(RE=r'\D30\D').
Queries support advanced dict-based operators for precise filtering:
-
Comparison:
$eq(equal),$ne(not equal),$le(less than or equal to), and$ge(greater than or equal to). -
Range & Inclusion: Use
$lt(less than),$gt(greater than), and$in(to check if a value exists within a specific list). -
Array Operators: Use
$sizeto match the exact length of a list or array (e.g.,{'tags': {'$size': 2}}). -
Logical Operators: Combine conditions using
$and,$or, and$notwithin thevalsdictionary. Alternatively, you can use direct keyword arguments likeAND=[...],OR=[...], andNOT={...}for cleaner syntax.