query
Execute read-only queries in ArcadeDB using SQL, Cypher, Gremlin, GraphQL, or MongoDB syntax to retrieve data from multi-model databases.
Instructions
Execute a read-only (idempotent) query against an ArcadeDB database. Use this for SELECT, MATCH, and other read operations. Prefer OpenCypher (language: 'cypher') unless SQL is explicitly requested.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database | Yes | The name of the database to query | |
| language | No | Query language: 'sql', 'cypher', 'gremlin', 'graphql', 'mongo' | cypher |
| query | Yes | The query to execute | |
| limit | No | Maximum number of results to return (default: 1000) |
Implementation Reference
- The handler logic for the 'query' method within the Database class, which executes a database query using the underlying Java implementation.
def query(self, language: str, command: str, *args) -> ResultSet: """Execute a query and return results.""" self._check_not_closed() try: if args: # Convert NumPy arrays to Java float arrays converted_args = [] for arg in args: if ( hasattr(arg, "__class__") and arg.__class__.__name__ == "ndarray" ): converted_args.append(to_java_float_array(arg)) else: converted_args.append(arg) java_result = self._java_db.query(language, command, *converted_args) else: java_result = self._java_db.query(language, command) return ResultSet(java_result) except Exception as e: raise ArcadeDBError(f"Query failed: {e}") from e