Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Python Rocksdb
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
Python Rocksdb
Commits
46298a8f
Commit
46298a8f
authored
11 years ago
by
hofmockel
Browse files
Options
Downloads
Patches
Plain Diff
Add a text about bytes and unicode in pyrocksdb
parent
38f9c6b5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/tutorial/index.rst
+23
-0
23 additions, 0 deletions
docs/tutorial/index.rst
with
23 additions
and
0 deletions
docs/tutorial/index.rst
+
23
−
0
View file @
46298a8f
...
@@ -29,6 +29,29 @@ A more production ready open can look like this ::
...
@@ -29,6 +29,29 @@ A more production ready open can look like this ::
It assings a cache of 2.5G, uses a bloom filter for faster lookups and keeps
It assings a cache of 2.5G, uses a bloom filter for faster lookups and keeps
more data (64 MB) in memory before writting a .sst file
more data (64 MB) in memory before writting a .sst file
About bytes and unicode
========================
RocksDB stores all data as uninterpreted *byte strings*.
pyrocksdb behaves the same and uses nearly everywhere byte strings too.
In python2 this is the ``str`` type. In python3 the ``bytes`` type.
Since the default string type for string literals differs between python 2 and 3,
it is strongly recommended to use an explicit ``b`` prefix for all byte string
literals in both python2 and python3 code.
For example ``b'this is a byte string'``. This avoids ambiguity and ensures
that your code keeps working as intended if you switch between python2 and python3.
The only place where you can pass unicode objects are filesytem paths like
* Directory name of the database itself :py:meth:`rocksdb.DB.__init__`
* :py:attr:`rocksdb.Options.wal_dir`
* :py:attr:`rocksdb.Options.db_log_dir`
To encode this unicode objects the `sys.getfilesystemencoding()` encoding is used
Access
Access
======
======
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment