[ckan-dev] Shared access to the database

Richard Gomes rgomes.info at gmail.com
Tue Sep 17 14:22:47 UTC 2013


Hi Ross,

Thanks a lot for your prompt response.

I'm using Python, so programming language integration is not a problem.

At the moment, I'm performing calls to the Action API via web interface, 
like shown below:

     def call(self, action, **kwargs):
         import urllib2
         import urllib
         import json

         location = '%s/%s/action/%s' % (self.base_location, 
self.api_version, action)
         request = urllib2.Request(location)
         request.add_header('Authorization', self.api_key)
         ... etc...
                 response = urllib2.urlopen(request, 
urllib.quote(json.dumps(kwargs)))
                 ... etc...

With ~130 methods available in the Action API, it looked like all I need 
was available there.
But soon I found that there's no user_delete / user_purge in the API. An 
alternative would be employing ckan.model directly.

Also, performing a service call over the network costs obviously more 
than calling SQLAlchemy functions directly.
Performance would not be a problem initially, but it would impact 
scalability later. And I wouldn't like to redesign the application later.

So, I came back to the drawing board to re-evaluate my initial design 
decisions.
In case performance and flexibility gain more importance in this 
balance, I would like to anticipate future problems of this idea of 
having multiple applications sharing the database directly.

Thanks a lot :)

Richard Gomes
http://rgomes.info
http://www.linkedin.com/in/rgomes
mobile: +44(77)9955-6813
inum <http://www.inum.net/>: +883(5100)0800-9804

On 17/09/13 14:21, Ross Jones wrote:
> Would you not be better to use the API? It seems like the obvious 
> approach to putting stuff into CKAN without looking at either core or 
> an extension.  Even if there is no API wrapper for your chosen 
> language the API is reasonably straight-forward to use and documented.
>
> Ross
>
> On 17/09/13 14:59, Richard Gomes wrote:
>> Hello,
>>
>> Suppose I have one CKAN application running, like when we start it in 
>> the regular way using the paster command.
>> Now suppose I have "another application" running, which accesses the 
>> same database, via classes exposed via ckan.model package.
>>
>> Now suppose that the "another application" adds/updates/deletes 
>> objects to/from the database.
>> What would be the impact onto CKAN instance?
>>
>> To be more precise about the architecture... I'm not willing to dig 
>> inside the architecture/code/design of CKAN; I'm not willing to 
>> create plugins for it. I'm happy with what it provides.
>> I prefer to have my own small applications, which can be web 
>> applications or not, which are small, simple and under my full 
>> control and full understanding.
>> These small applications are responsible for inserting content onto 
>> CKAN, as well as managing organizations, users and packages.
>>
>> Then I would like to know what would be the impact of such 
>> architecture onto a regular CKAN instance.
>>
>> Any assistance / ideas / sharing of experiences are very much 
>> appreciated.
>>
>> Thanks a lot :)
>>
>> Richard Gomes
>> http://rgomes.info
>> http://www.linkedin.com/in/rgomes
>> mobile: +44(77)9955-6813
>> inum <http://www.inum.net/>: +883(5100)0800-9804
>>
>>
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> http://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe:http://lists.okfn.org/mailman/options/ckan-dev
>
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130917/041c5cb2/attachment-0001.html>


More information about the ckan-dev mailing list