Importing data as object from another database

Author Message

Shurbann Martes

Wednesday 19 November 2003 6:32:17 am

Hello there,

I'm looking for an answer (way to start) to this problem:
I have a database with information that comes from another application I made. This application stores these information in another DB (so not the same DB as eZ is using).

Now I want to store some of these data into eZ as object. I looked around and found this in the forum:

http://www.ez.no/developer/ez_publish_3/forum/developer/creating_a_simple_content_object_via_php

That's exactly what I'm looking for, need a little bit of tweaking, but ok. Still I dont know how and where to put this little script (if I may call it so) .

Should I put it like in the cronjobs directory where it will be running using cron or somewhere else?. I would appreciate it if someone can shed some light on this.

TIA,
Shurbann

Claus Jensen

Wednesday 19 November 2003 7:08:52 am

Hi Shurbann,
I've done some importing of objects this way, as you may have seen on the thread you refer to. You should put this script in the root folder ezpublish, and there it may fetch ini-files from your installation. Ofcourse it may also be run from a cron-script is that is what you prefer, but for me it was a "one-time-job". Also, this was a flat-file import, exported into commaseparated or semicolon from the other database. Anyway, it is timing out after about 249-250 objects, why I dont know, but now you are aware. The solution for us was to "chop" our flat-file into several flatfiles containing only a "safe" number of records ..say 230-240 or so.

Hope you get some idea from this. Good luck!

regards,
claÜs

Shurbann Martes

Thursday 20 November 2003 4:23:55 am

Thank you Claus, I think you gave me enough ideas/tips to start this project.

Once in the while there would be a new entry in this DB. So it's not a "one-time-job". There are not alot of entries, so I wont be having the problem of timing-out I hope.

Next challenge is how to keep track of what have already been imported. (But I wont bother you guys with that :) )

Shurbann

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 03:18:08
Script start
Timing: Jan 19 2025 03:18:08
Module start 'layout'
Timing: Jan 19 2025 03:18:08
Module start 'content'
Timing: Jan 19 2025 03:18:10
Module end 'content'
Timing: Jan 19 2025 03:18:10
Script end

Main resources:

Total runtime1.6306 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0075 589.2891152.6406
Module start 'layout' 0.00750.0044 741.929739.4766
Module start 'content' 0.01201.6173 781.4063473.2109
Module end 'content' 1.62930.0013 1,254.617212.4375
Script end 1.6306  1,267.0547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2112160.0002
Check MTime0.00130.0817160.0001
Mysql Total
Database connection0.00090.057910.0009
Mysqli_queries1.584897.1883570.0278
Looping result0.00060.0355550.0000
Template Total1.590997.620.7955
Template load0.00180.111120.0009
Template processing1.589197.453020.7946
Template load and register function0.00020.010610.0002
states
state_id_array0.00090.057910.0009
state_identifier_array0.00180.108120.0009
Override
Cache load0.00150.0907240.0001
Sytem overhead
Fetch class attribute can translate value0.00090.056220.0005
Fetch class attribute name0.00120.074830.0004
XML
Image XML parsing0.00020.015320.0001
class_abstraction
Instantiating content class attribute0.00000.000430.0000
General
dbfile0.00070.0402100.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs