Skip to content

Data Import & NoSQL Queries

Lukatrum edited this page May 15, 2026 · 8 revisions

omni-JSON-db: Data Import & NoSQL Queries

This wiki page outlines the data import methods and NoSQL querying capabilities available in JDb.

Data Import Features

The JDb object supports importing data from various formats and relational databases.

1. INI & TOML Import

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.

2. SQLite Import

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 projects table using jdb.get_group('projects') or jdb['projects'].

NoSQL Query Features

The find() method provides robust, MongoDB-style NoSQL querying capabilities to filter your JSON data.

Basic & Regex Matching

  • Exact Match: Use the ANY parameter, such as jdb.find(ANY={'name': 'Alice'}) or jdb.find(ANY='Alice').
  • Regular Expressions: Use the vals or RE parameters for regex matching, such as jdb.find(vals={'name': r'li[a-z]'}) or jdb.find(RE=r'\D30\D').

Logical & Comparison Operators

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 $size to match the exact length of a list or array (e.g., {'tags': {'$size': 2}}).
  • Logical Operators: Combine conditions using $and, $or, and $not within the vals dictionary. Alternatively, you can use direct keyword arguments like AND=[...], OR=[...], and NOT={...} for cleaner syntax.

Clone this wiki locally