Query SQL and NoSQL servers¶
SQL¶
SQL servers are traditional databases with predefined data schema. Furthermore, modern versions also support BLOB data.
You can search in the following servers:
The configuration of the new database engines are similar. You must put a valid
SELECT SQL query in query_str
. At the moment you can only bind at most
one parameter in your query.
Do not include LIMIT or OFFSET in your SQL query as the engines rely on these keywords during paging.
PostgreSQL¶
Required PyPi package: psychopg2
You can find an example configuration below:
- name : postgresql
engine : postgresql
database : my_database
username : searx
password : password
query_str : 'SELECT * from my_table WHERE my_column = %(query)s'
shortcut : psql
Available options¶
host
: IP address of the host running PostgreSQL. By default it is127.0.0.1
.port
: Port number PostgreSQL is listening on. By default it is5432
.database
: Name of the database you are connecting to.username
: Name of the user connecting to the database.password
: Password of the database user.query_str
: Query string to run. Keywords likeLIMIT
andOFFSET
are not allowed. Required.limit
: Number of returned results per page. By default it is 10.
MySQL¶
Required PyPi package: mysql-connector-python
This is an example configuration for quering a MySQL server:
- name : mysql
engine : mysql_server
database : my_database
username : searx
password : password
limit : 5
query_str : 'SELECT * from my_table WHERE my_column=%(query)s'
shortcut : mysql
Available options¶
host
: IP address of the host running MySQL. By default it is127.0.0.1
.port
: Port number MySQL is listening on. By default it is3306
.database
: Name of the database you are connecting to.auth_plugin
: Authentication plugin to use. By default it iscaching_sha2_password
.username
: Name of the user connecting to the database.password
: Password of the database user.query_str
: Query string to run. Keywords likeLIMIT
andOFFSET
are not allowed. Required.limit
: Number of returned results per page. By default it is 10.
SQLite¶
You can read from your database my_database
using this example configuration:
- name : sqlite
engine : sqlite
shortcut: sq
database : my_database
query_str : 'SELECT * FROM my_table WHERE my_column=:query'
Available options¶
database
: Name of the database you are connecting to.query_str
: Query string to run. Keywords likeLIMIT
andOFFSET
are not allowed. Required.limit
: Number of returned results per page. By default it is 10.
NoSQL¶
NoSQL data stores are used for storing arbitrary data without first defining their structure. To query the supported servers, you must install their drivers using PyPi.
You can search in the following servers:
Redis¶
Reqired PyPi package: redis
Example configuration:
- name : mystore
engine : redis_server
exact_match_only : True
host : 127.0.0.1
port : 6379
password : secret-password
db : 0
shortcut : rds
enable_http : True
Available options¶
host
: IP address of the host running Redis. By default it is127.0.0.1
.port
: Port number Redis is listening on. By default it is6379
.password
: Password if required by Redis.db
: Number of the database you are connecting to.exact_match_only
: Enable if you need exact matching. By default it isTrue
.
MongoDB¶
Required PyPi package: pymongo
Below is an example configuration for using a MongoDB collection:
- name : mymongo
engine : mongodb
shortcut : icm
host : '127.0.0.1'
port : 27017
database : personal
collection : income
key : month
enable_http: True
Available options¶
host
: IP address of the host running MongoDB. By default it is127.0.0.1
.port
: Port number MongoDB is listening on. By default it is27017
.password
: Password if required by Redis.database
: Name of the database you are connecting to.collection
: Name of the collection you want to search in.exact_match_only
: Enable if you need exact matching. By default it isTrue
.