[redland-dev] Some basic questions: mostly mysql related
Dave Beckett
dave at dajobe.org
Fri Aug 11 01:50:21 UTC 2006
Murray Woodman wrote:
> I'm new to using to Redland (and Python) so please excuse me if some of
> these questions are a little basic. I'm really enjoying using Redland so
> far - I just have a few humps to get over :). I'm using the Python
> bindings and MySQL 5 as storage. I've decided to keep all these
> questions in one email as they are probably pretty basic to answer.
>
> The MySQL character set seems to be latin1. Is there any reason why this
> is not unicode? You probably want to keep it backwards compatible with
> earlier versions of MySQL. Unicode still goes in and out OK - it just
> looks a little weird when it's in there and I guess the sorting will be
> a little off. Would there be any danger in me altering the tables in
> MySQL to make the the charset unicode?
I didn't write the original scheam, but Unicode sounds like a much better
idea to me than latin1. Danger is presumably all existing stores would
have to migrate.
> How do you drop a model from a persistent store such as MySQL. I can't
> see how to do this through the API. I did find a script to do this
> directly on the DB
> <http://www.wasab.dk/morten/2004/09/redland-mysql-drop-model> but
> thought there might be a way to do it through the API.
There's no way to do that at present except when you create a new
storage with the option "new='yes'".
It probably should be a call on the storage API.
> I note that rows in the literal/resource/bnode tables are not deleted
> when their "parent" statement is deleted. I understand that this happens
> because a node row can be referred to in different models or contexts.
> As a result there will be a lot of orphaned literals, resources and
> bnodes as statements are deleted - resulting in wasted space in the DB.
> Is there a way to avoid/fix this in the API or is it just a clean up job
> to be scripted in SQL?
I think Morten has a cleanup script for that somewhere. It also might
be worth adding as a storage API call cleanup() or something().
> Finally, what is the best way to update a whole bunch of statements with
> context whilst keeping the server downtime to a minimum? ie. How do I
> best load in a completely fresh version of a particular context? To me
> it seems that I would have to delete all statements with a context and
> then load the new ones in. The downside is that the model will be
> missing data for a while. This would be particularly problematic if the
> parsing took a long time and users expected complete data for their
> queries etc. Is there are better way to do it? For instance, is there a
> way to load in some data into a different model (m2), delete the context
> statements in m1 and then quickly(?) move the data from m2 into m1.
I can't think of a way to do this without basically keeping two models
around and then switching the model variable you use between live/updating
models.
> Maybe this is a job for SQL as well?
Don't think that can guarantee instant updates either, as writes will
presumably lock rows/records or whatever. In this case, you might
prefer a database that has fine grained locking, I think PostgreSQL does
that, but I'm no expert on either.
> Thanks for a great product and your patience with the above.
Dave
More information about the redland-dev
mailing list