AppEngine Bulkloader generate data during import - google-app-engine

I imported a CSV into the datastore and want to generate a field StringListProperty with a custom action during import (e.g. index generation, doing some calculations). I tried to override the put() method of my model like it is described in question Override save, put, get, etc... methods in Google App Engine, but during bulkloader import this has no effect.

look into google.appengine.ext.bulkload.bulkloader_wizard, there isn't a default transformer for list of str/unicode. You have to make your own.

Related

CommerceTools Initial Load

What is the best way to import >5 million records of customer into commerce tools?
I only need it to load initial load but I don't need any sync services between external sources and commercetools multiple times
process of finding delta can be done outside.
I went through the import API documentation https://docs.commercetools.com/import-export/
#option 1: Impex UI, I believe its node backed application. Does it uses Import API?
#option 2: Project Sync. It uses Import API and abstract batching, http request etc
#option 3: Import API SDK. It abstract http request
With large dataset to import for initial load, it sounds like #2 Project sync would be better choice since it has batching. It looks like it calculates delta before syncing to commercetools which I dont need since I want to use it for initial load.
Which option should i use?
The Import API is a good choice for customers and order imports as the import api will resolve customer references on the orders by key.
You can also consider using the API directly using the sdk of your choice.
Does that help?
Best Regards
Brian

How can I efficiently restrict a non-CMS page view to a user group in wagtail with 'permissions_required' hook?

I have an app within my wagtail site which uses several pages constructed in views.py (here because they contain complex-ish processing of forms and data and do not need any CMS functionality). One of these views, I want to restrict to users of a specific group.
For other pages, I use a #logon required mixin, which works fine. I can write some code which uses something like def has_group(user, group_name):
return user.groups.filter(name=group_name).exists(), but this seems messy when wagtail has a nice built in permissions model. Therefore, I am trying to use the following hook in wagtail_hook.py:
from django.contrib.auth.models import Permission
from wagtail.core import hooks
#hooks.register('register_permissions')
def view_committee_page():
return Permission.objects.filter(codename="view_committee_page")
This isn't showing up in wagtail admin under group object permissions as I believe it should.
My understanding is only based on the odd example I've found using Wagtail v1.X. The documentation is vague on this specific hook: https://docs.wagtail.io/en/v2.5.1/reference/hooks.html#register-permissions
The only modification I've made to the examples I've seen (eg. here: Wagtail set additional permissions for MyPage ) is to update wagtail.wagtailcore to wagtail.core as per 2.0 release notes.
I know my wagtail_hooks.py file is being picked up correctly as I have another hook in there working as expected.
Am I missing something? Is there a more up to date way to solve this problem?
How about creating your own function with the decorator:
#hooks.register('before_serve_page')
in watail_hooks.py there is a function called check_view_restrictions() so you could do something similar to this?
You would also need to set the permissions on your Page model.
from wagtail.core.models import Page
class MyPage(Page):
class Meta:
permissions = (("page_view_only", "Can view my pages"),)
Then use the hook in wagtail_hooks.py
from django.contrib.auth.models import Permission
from wagtail.core import hooks
#hooks.register('register_permissions')
def page_view_only():
return Permission.objects.filter(codename="page_view_only")
There should be a new permission available in the admin Group settings.

Protégé import from http://w3id.org/XXX

I am having problems importing two ontologies in Protégé. These ontologies are stored in the following links Onto1 and Onto2 and are also in the W3ID.ORG URL re-direction service (Onto1Redirection and Onto2Redirection).
I tried to import both of them using Protege's Direct Import => Add => Import an ontology contained in a document located on the web option. I tried introducing both the original OWL file's and the redirection URL.
However, after saving the ontology and loading it, imports are not correctly done (i.e. one or the other is not imported).
Any guidance in this matter will be appreciated.

Drupal 7 import page programmatically

I'm trying to create script for auto data import from one drupal site to other.
I have site foo.com and bar.com I'm trying to import everything from bar.com into foo.com.
So far I've managed to write script that imports all content types, nodes, blocks, etc. All that left is to import page with content. CTools module has clear function to export page data (panels, varants and etc...) but i cant find import function. (in admin panel there is way to import exported page, but import goes through a lot of functions, its too difficult to track all the way)
Is there an easer way to import page programmatically?
If you want to import anything from one site to another you are doing a site synchronization. And the best tool for this is Drush and commands rsync and sql-sync. See at Using Drush to synchronize and deploy sites.
If you want to import only Panel Pages you may use the Panel Import and of course Features.
An alternative option is Demo module to create site snapshots. Then a custom module can be used with a button to enable a demo snapshot.
And a more alternative idea is to create some feature modules (that add content, views, panels etc) and then a simple module that will have all these modules as required.

Ontology not getting data from imported ontology

I have an ontology and I use the OWL API to import another ontology,
OWLImportsDeclaration importDeclaraton = Factory.getOWLImportsDeclaration(IRI.create("file:/path/to/ontology.owl"));
ontology.getOWLOntologyManager().applyChange(new AddImport(ontology, importDeclaraton));
The new ontology contain some abox assertions in it, however, when I query the ontology for its abox axioms, there is nothing in it.
System.out.println(ontology.getABoxAxioms(true));
returns []
At the moment the OWL API does not seem to load imports on the fly, i.e., when a new import is added programmatically - it will attach the imported ontology if that ontology is already loaded, but it will not load a new ontology when the import is added.
I think this is a bug - there should at least be an option to load ontologies used in imports at the time the import is created. I'll add an issue for this.
Updates will be available here.

Resources