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

Add support for PostgreSQL HSTORE #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aronbierbaum
Copy link

This adds a use_hstore parameter that will cause all OSM tags to be added to a hstore tags column. This can be useful when you want to query the features for all available data.

@olt
Copy link
Member

olt commented Nov 7, 2013

Cool.
I think you still need to get the filters to not filter out any tags at all, if you want your HStore to contain everything.

@aronbierbaum
Copy link
Author

Thank you for pointing that out. I have added a function set_hstore_all that should disable all filtering. Does this seem like a reasonable approach?

@aronbierbaum
Copy link
Author

Using a global similar to the name type was the simplest way I could come up with for disabling tag filtering. This makes we wonder if we should still have a use_hstore property on each mapping though. If I understand things correctly it does still add some value though because there are two levels of tag filtering. The first level determines what is parsed and the second determines what is actually added to the database.

@olt
Copy link
Member

olt commented Nov 7, 2013

The first filtering reduces the data in the imposm cache files (cache only tags you're using later). In the PostGIS package it decides which tag needs to be inserted into the actual tables.

You still need to do that. But only by disabling the first filter, you're able to insert all tags into the hstore column of a table.

@@ -24,6 +24,7 @@
createdb -E UTF8 -O ${user} ${dbname}
createlang plpgsql ${dbname}
${postgis}
echo "CREATE EXTENSION hstore;" | psql -d ${dbname}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should put that at the end and comment it out with a comment, that you need to add it for hstore support.

@olt
Copy link
Member

olt commented Nov 7, 2013

I'm not sure if a global variable and use_hstore is the best solution.
What if someone wants to have only a list of keys in the hstore column, or if he wants to filter out some columns?
I would like to see hstore as another field type with the option to include/exclude keys, or to take all.

E.g:

amenities = Points(
    name='amenities',
    fields=('tags', HStore(include=['opening_hours', ....]),),
    mapping = {
        'amenity': (
            '__any__',
        ),
})

HStore.extra_fields could return a special key to signal the _tag_filter that it wants all tags.

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

Successfully merging this pull request may close these issues.

2 participants