Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dictionary() property doesn't work due to invalid hashmap conversion #145

Open
chiffa opened this issue Aug 3, 2014 · 4 comments
Open

Comments

@chiffa
Copy link

chiffa commented Aug 3, 2014

When the Dictionary property is attached and used the following error arises:

SystemError: ({'status': '200', 'content-length': '110', 'content-type': 'application/json; charset=UTF-8', 'access-control-allow-origin': '*', 'server': 'Jetty(6.1.25)'}, '"java.lang.IllegalArgumentException: Unknown property type on: {nom=1, mnom=1}, class java.util.LinkedHashMap"')

@espeed
Copy link
Owner

espeed commented Aug 4, 2014

Some DBs such as Neo4j don't allow properties to be dictionaries (only primitive arrays). In this case you can use the Bulbs Document type instead of Dictionary -- the Document type converts Python dicts to JSON string before writing to the DB, and it converts JSON strings back to Python dicts when read from the DB.

@chiffa
Copy link
Author

chiffa commented Aug 4, 2014

Great, would you mind providing more info about the Document type? I couldn't find it in the usual property documentation location: http://bulbflow.com/docs/api/bulbs/property/#property

@espeed
Copy link
Owner

espeed commented Aug 4, 2014

The online docs need to be updated. The Document Property is defined here:

And here's how it gets called when using the default JSON type system:

NOTE: The Document Property definition uses the JSON type system's to_document() method to convert a Python dict to a JSON string when saving to the database, but it uses the to_dictionary() method to convert the JSON string to a Python dict when reading from the database.

@chiffa
Copy link
Author

chiffa commented Aug 4, 2014

Great, thanks. Would you mind adding it to doc in a future release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants