A library which parses URIs and converts them to ZODB storage objects and database arguments.
See the documentation at https://docs.pylonsproject.org/projects/zodburi/en/latest/ for more information.
Construct ZODB storage instances from URIs.
License: Other
A library which parses URIs and converts them to ZODB storage objects and database arguments.
See the documentation at https://docs.pylonsproject.org/projects/zodburi/en/latest/ for more information.
Hi,
While I tried to use RelStorage to connect to zodb database in mysql. I got below error:
Is it something wrong in my configuration or a bug?
Thanks a lot in advance,
-Shu
ubuntu@ip-10-249-36-183:~/sercle.net-0.0.1$ pserve development.ini
2013-03-27 06:29:05,563 DEBUG [relstorage.cache][MainThread] Initializing checkpoints: 0 0
2013-03-27 06:29:05,564 DEBUG [relstorage][MainThread] POSKeyError on oid 0: no tid found; No previous transactions exist; Recent object tids: []
2013-03-27 06:29:05,564 DEBUG [txn.139849454085888][MainThread] new transaction
Traceback (most recent call last):
File "/usr/local/bin/pserve", line 9, in
load_entry_point('pyramid==1.4', 'console_scripts', 'pserve')()
File "/usr/local/lib/python2.7/dist-packages/pyramid-1.4-py2.7.egg/pyramid/scripts/pserve.py", line 50, in main
return command.run()
File "/usr/local/lib/python2.7/dist-packages/pyramid-1.4-py2.7.egg/pyramid/scripts/pserve.py", line 304, in run
global_conf=vars)
File "/usr/local/lib/python2.7/dist-packages/pyramid-1.4-py2.7.egg/pyramid/scripts/pserve.py", line 328, in loadapp
return loadapp(app_spec, name=name, relative_to=relative_to, *_kw)
File "/usr/local/lib/python2.7/dist-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, *_kw)
File "/usr/local/lib/python2.7/dist-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/usr/local/lib/python2.7/dist-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/usr/local/lib/python2.7/dist-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, *_context.local_conf)
File "/usr/local/lib/python2.7/dist-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py", line 56, in fix_call
val = callable(_args, *_kw)
File "/home/ubuntu/sercle.net-0.0.1/serclenet/init.py", line 43, in main
settings=settings)
File "/usr/local/lib/python2.7/dist-packages/pyramid-1.4-py2.7.egg/pyramid/config/init.py", line 308, in init
exceptionresponse_view=exceptionresponse_view,
File "/usr/local/lib/python2.7/dist-packages/pyramid-1.4-py2.7.egg/pyramid/config/init.py", line 433, in setup_registry
self.include(inc)
File "/usr/local/lib/python2.7/dist-packages/pyramid-1.4-py2.7.egg/pyramid/config/init.py", line 773, in include
c(configurator)
File "/usr/local/lib/python2.7/dist-packages/pyramid_zodbconn-0.4-py2.7.egg/pyramid_zodbconn/init.py", line 109, in includeme
db = db_from_uri(uri, name, databases) # side effect: populate "databases"
File "/usr/local/lib/python2.7/dist-packages/pyramid_zodbconn-0.4-py2.7.egg/pyramid_zodbconn/init.py", line 69, in db_from_uri
return DB(storage, databases=dbmap, *_dbkw)
File "/usr/local/lib/python2.7/dist-packages/ZODB-4.0.0a4-py2.7.egg/ZODB/DB.py", line 459, in init
temp_storage.tpc_vote(t)
File "/usr/local/lib/python2.7/dist-packages/relstorage/storage.py", line 789, in tpc_vote
return self._vote()
File "/usr/local/lib/python2.7/dist-packages/relstorage/storage.py", line 823, in _vote
self._prepare_tid()
File "/usr/local/lib/python2.7/dist-packages/relstorage/storage.py", line 705, in _prepare_tid
tid_int = u64(tid)
File "/usr/local/lib/python2.7/dist-packages/ZODB-4.0.0a4-py2.7.egg/ZODB/utils.py", line 82, in u64
return unpack(">Q", v)[0]
struct.error: unpack requires a string argument of length 8
resolve_url
only allows cache_size
and pool_size
(under other names) and database_name.
Why not allow all database (DB
) parameters?
setuptools has just been released: https://setuptools.pypa.io/en/latest/history.html#v67-3-0
On a clean virtualenv, install zodburi
, setuptools==67.3.1
and pytest, and run a dummy test:
def test_foobar():
import zodburi
This will raise this warning:
________________________________________________________ test_foobar _________________________________________________________
def test_foobar():
> import zodburi
test_foobar.py:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/zodburi/__init__.py:2: in <module>
from pkg_resources import iter_entry_points
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/pkg_resources/__init__.py:3257: in <module>
def _initialize_master_working_set():
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/pkg_resources/__init__.py:3231: in _call_aside
f(*args, **kwargs)
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/pkg_resources/__init__.py:3282: in _initialize_master_working_set
tuple(dist.activate(replace=False) for dist in working_set)
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/pkg_resources/__init__.py:3282: in <genexpr>
tuple(dist.activate(replace=False) for dist in working_set)
../.local/share/virtualenvs/test-sanl/lib/python3.10/site-packages/pkg_resources/__init__.py:2803: in activate
declare_namespace(pkg)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
packageName = 'zc'
def declare_namespace(packageName):
"""Declare that package 'packageName' is a namespace package"""
msg = (
"Implementing implicit namespace packages (as specified in PEP 420) "
"is preferred to `pkg_resources.declare_namespace`. "
"See https://setuptools.pypa.io/en/latest/references/"
"keywords.html#keyword-namespace-packages"
)
> warnings.warn(msg, DeprecationWarning, stacklevel=2)
E DeprecationWarning: Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
The warning is not raised with setuptools 66
Hey @chrisrossi, @jimfulton or @tseaver,
In your absence on this project, would it be possible to add any of the following people as owner on PyPI for this project:
xistence
- (me, @bertjwregeer)mmerickel
- @mmerickelpylonsbot
- release bot/continuance botThere's been a request for someone else to step up and help maintain this project in the mean time, and it would be great if we can help things along in the mean time by reviewing and merging tickets/releasing new updates to PyPI.
Thank you,
Bert
It is very useful to use a DemoStorage
on top of a MappingStorage
, for instance in unit testing with support for conflicts resolution (MappingStorage
cannot solve conflicts, but DemoStorage+MappingStorage
can).
Thus, I would love zodburi to handle this.
import zodburi
factory, args = zodburi.resolve_uri("memory://storagename?demostorage=true")
# KeyError: 'Unrecognized database keyword(s): demostorage'
What do you think?
The code has a workaround for a urlparse.urlsplit bug in the 2.6 stdlib; that bug is fixed in 2.7, so the workaround breaks::
$ tox -e py27
py27 create: /home/tseaver/projects/repoze/src/zodburi/.tox/py27
py27 sdist-inst: /home/tseaver/projects/repoze/src/zodburi/.tox/dist/zodburi-1.1.zip
py27 runtests: commands[0]
running test
running egg_info
writing requirements to zodburi.egg-info/requires.txt
writing zodburi.egg-info/PKG-INFO
writing top-level names to zodburi.egg-info/top_level.txt
writing dependency_links to zodburi.egg-info/dependency_links.txt
writing entry points to zodburi.egg-info/entry_points.txt
reading manifest file 'zodburi.egg-info/SOURCES.txt'
writing manifest file 'zodburi.egg-info/SOURCES.txt'
running build_ext
.........................No handlers could be found for logger "ZEO.zrpc"
.............................FFF
======================================================================
FAIL: test_named_storage (zodburi.tests.test_resolvers.TestZConfigURIResolver)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tseaver/projects/repoze/src/zodburi/zodburi/tests/test_resolvers.py", line 305, in test_named_storage
self.assertTrue(isinstance(storage, MappingStorage), storage)
AssertionError: False is not true
======================================================================
FAIL: test_query_string_args (zodburi.tests.test_resolvers.TestZConfigURIResolver)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tseaver/projects/repoze/src/zodburi/zodburi/tests/test_resolvers.py", line 334, in test_query_string_args
self.assertEqual(dbkw, {'foo': 'bar'})
AssertionError: {} != {'foo': 'bar'}
- {}
+ {'foo': 'bar'}
======================================================================
FAIL: test_storage_not_found (zodburi.tests.test_resolvers.TestZConfigURIResolver)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/tseaver/projects/repoze/src/zodburi/zodburi/tests/test_resolvers.py", line 343, in test_storage_not_found
self.assertRaises(KeyError, resolver, 'zconfig://%s#y' % self.tmp.name)
AssertionError: KeyError not raised
----------------------------------------------------------------------
Ran 57 tests in 0.187s
FAILED (failures=3)
See: readthedocs/readthedocs.org#2339
When that issue is resolved, or when ZEO 5 has a final release, then remove the line in rtd.txt that pins ZEO to 4.2.1.
I'm writing a resolver for newt. I has to sort of guess how to do this by looking at the documentation for resolve_url and looking at relstorage sources, however I guessed wrong about handling of DB parameters.
zodburi requires ZODB3 which is not compatible with python 3, to fix it you can use ZODB instead of ZODB3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.