This project has been archived by its maintainers, and is no longer receiving any updates.
Overview
Pyravendb-Embedded is a RavenDB package for running RavenDB in embedded mode.
EmbeddedServer().start_server()
with EmbeddedServer().get_document_store("Embedded") as store:
with store.open_session() as session:
session.store(User(name="Ilay", age=4))
session.save_changes()
Installation
Install from PyPi, as pyravendb-embedded_.
pip install pyravendb
Install Pyravendb-Embedded from pip will provide you with a copy of RavenDB server binaries files as well
Usage
Start a server
To start RavenDB server you only need to run start_server() method from EmbeddedServer instance and that’s it.
EmbeddedServer.start_server()
To be more in control about your server start_server method can take one parameter server_options.
ServerOptions
framework_version - The framework version to run the server with.
data_directory - Where to save the database data (if None the files will be saved in RavenDB folder in the base folder).
server_url - The url the server will be opened if None the server will open on local host.
- dotnet_path - Where dotnet.exe is located if dotnet in the PATH nothing needed here (If .net core is not installed in your machine
you can download dotnet binaries and just put the path to it)
command_line_args - A list of all server command args.
server_options = ServerOptions(data_directory="MYPATH/RavenDBDataDir")
EmbeddedServer().start_server(server_options)
Security
There are two options to make ravendb secured in Pyravendb-Embedded:
secured(certificate_path, certificate_password=None) - For this option you will put a path to a .pfx file for the server and a password to the file if you have one.
server_options = ServerOptions() server_options.secured("PATH_TO_PFX_CERT_FILE", "PASSWORD_TO_CERT_FILE") EmbeddedServer.start_server(server_options)secured_with_exec(self, cert_exec, cert_exec_args, server_cert_fingerprint, client_cert_path, client_cert_password=None) - For this option you will have to put executable program (ex. powershell, python, etc) and the arguments for him, the fingerprint of the cert file you can use pyravendb Utils for that (see get_cert_file_fingerprint method), the client cert path and the password if you have one.
server_options = ServerOptions() sserver_options.secured_with_exec("powershell", "C:\\secrets\\give_me_cert.ps1", Utils.get_cert_file_fingerprint("PATH_TO_PEM_CERT_FILE"), "PATH_TO_PEM_CERT_FILE") EmbeddedServer.start_server(server_options)
Get Document Store
After initialize and start the server we can use get_document_store method to be able to get a DocumentStore and start work with RavenDB as normal.
EmbeddedServer().start_server()
with EmbeddedServer().get_document_store("Test") as store:
pass
get_document_store method can get or only the database_name or DatabaseOption
DatabaseOptions
database_name - The name of the database
skip_creating_database - get_document_store will create a new database if the database is not exists, if this option if True we won’t create the database (Default False).
# In this example we won't create the Test database if not exists will raise an exception
database_options = DatabaseOptions(database_name="Test", skip_creating_database=True)
with EmbeddedServer().get_document_store(database_options) as store:
# Your code here
Open the RavenDB studio in the browser
To open RavenDB studio from Pyravendb-Embedded you can use open_studio_in_browser method and the studio will open automatically one your default browser.
EmbeddedServer().open_studio_in_browser()
Acknowledgments
EmbeddedServer class is a singleton!
Every time we use EmbeddedServer() we will get the same instance.
Metadata
Release files for pyravendb-embedded 4.1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyravendb-embedded-4.1.1.4.tar.gz | 23.7 MB | Without provenance | Details |
Release files / pyravendb-embedded-4.1.1.4.tar.gz
| Download URL | pyravendb-embedded-4.1.1.4.tar.gz |
|---|---|
| Size | 23.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe65d9f40827934d4521d5a254fd72348970b48bc949055e7929bf1efce26172
|
|
BLAKE2b-256 checksum How to use checksums |
0c5bbeb689220f6aac64368b6862d40028c3a66e9cef1853221e9341dc97feed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/36.2.7 requests-toolbelt/0.8.0 tqdm/4.15.0 CPython/3.6.2
|
Security for pyravendb-embedded 4.1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.