CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Why SQL Import only for Contacts?
Pages: [1]

Author Topic: Why SQL Import only for Contacts?  (Read 1213 times)

Luciano S.

  • I post occasionally
  • **
  • Posts: 83
  • Karma: 2
  • iXiam Team Leader
  • CiviCRM version: 4.2+ / 4.3+ / 4.4+
  • CMS version: Drupal
  • MySQL version: 5.1+ / 5.5+
  • PHP version: 5.3+ / 5.4+
Why SQL Import only for Contacts?
May 25, 2011, 04:28:19 am
hey guys,

is there any reason why the SQL Query Import Option is available only for Contacts?

Would be nice to have this for Import Membership, Contributions and Activity as well.. the speed difference between SQL and CSV is considerable with large files.

thanks!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Why SQL Import only for Contacts?
May 25, 2011, 06:54:46 am

This has not been coded as yet. Can you take a look at how it is done in contact and do something similar for the other imports. You should be able to reuse most of the code from contact

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Why SQL Import only for Contacts?
May 25, 2011, 09:20:23 am
Hi,

If you have access to the shell, you can also import from csv (faster/less painful than via the web)

http://civicrm.org/blogs/xavier/api_batch_tools

or you might want to code your own import script.

(there is more than one way of...)


X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Luciano S.

  • I post occasionally
  • **
  • Posts: 83
  • Karma: 2
  • iXiam Team Leader
  • CiviCRM version: 4.2+ / 4.3+ / 4.4+
  • CMS version: Drupal
  • MySQL version: 5.1+ / 5.5+
  • PHP version: 5.3+ / 5.4+
Re: Why SQL Import only for Contacts?
June 07, 2011, 08:23:21 am
Hi xavier,

nice work with api importer tool, it's much faster than the web form
anyway you need to take time to adjust the csv to the right format.

i have a question about it:

Is it possible to import multiples contact's addresses and phones in the same process (same cvs file) with the contacts?

Let's say I have contact's with 2 addresses  (home & work) and 2 phones, can i write the csv somehow to import in one go all of them, or first I need to import the entity Contact, get the contact_id and then import entities Address and Phone?

I tried to create  cvs with the street components fields, (street_address, city, country, etc..) but they are not imported into the contact details.

Thanks in advance!
Luciano

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Why SQL Import only for Contacts?
June 07, 2011, 08:52:36 am
Hi,

That's very much a one entity only function so far.

However it wouldn't be too difficult to use the new chaining api to import all.

It would likely need to "unflatten" the csv structure to split the columns between the main api (contact creation) and the secondary ones (addresses/phones...)... patch more than welcome ;)

X+

P.S. use /civicrm/ajax/doc to find the column names http://civicrm.org/API_version_3
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Luciano S.

  • I post occasionally
  • **
  • Posts: 83
  • Karma: 2
  • iXiam Team Leader
  • CiviCRM version: 4.2+ / 4.3+ / 4.4+
  • CMS version: Drupal
  • MySQL version: 5.1+ / 5.5+
  • PHP version: 5.3+ / 5.4+
Re: Why SQL Import only for Contacts?
June 07, 2011, 09:08:12 am
Ok, good to know.

I'm having troubles when importing special spanish characters (á,é,ó,ñ, etc..)
for example if the name is "Quaíni", the api will import "Qua".

stops where the "special character is", should i encode the csv file in a particular way?
The same CSV file works fine when I use it to in the web form importer, but not from the api console

any ideas?

tx

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Why SQL Import only for Contacts?
June 07, 2011, 09:54:02 am

Quote from: sluc23 on June 07, 2011, 09:08:12 am
I'm having troubles when importing special spanish characters (á,é,ó,ñ, etc..)

unicode utf8 (ie don't use excel, it sucks so badly it hurts)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Why SQL Import only for Contacts?

This forum was archived on 2017-11-26.