PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db206070_45.uc_orders' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {uc_orders} uo LEFT OUTER JOIN {uc_countries} uc ON uo.billing_country = uc.country_id LEFT OUTER JOIN {uc_zones} uz ON uo.billing_zone = uz.zone_id WHERE (uo.order_status <> :db_condition_placeholder_0) ) subquery; Array ( [:db_condition_placeholder_0] => in_checkout ) in MigrateSourceSQL->computeCount() (Zeile 215 von /xxx/xxx/xxx/drupal/sites/all/modules/migrate/plugins/sources/sql.inc).

Comments

rfay’s picture

Title: Unable to import » Unable to import from a database that does not have ubercart installed
Category: bug » support

The database that you've configured to import from does not have a uc_orders table. Which (I think) means that it doesn't have ubercart configured.

jquery’s picture

The error comes by accessing the migrate tab. No way to configure any settings.

rfay’s picture

Sorry, you need to configure commerce migrate ubercart first, at admin/content/migrate/ubercart_migration_options

jquery’s picture

Status: Active » Closed (fixed)

Shame on me. Thank you.

rfay’s picture

Title: Unable to import from a database that does not have ubercart installed » admin/content/migrate should not throw a fatal if commerce migrate ubercart not yet configured
Assigned: jquery » Unassigned
Category: support » bug
Status: Closed (fixed) » Active

No, no shame on you. I shouldn't work that way. I don't know how to fix it, but this is a valid bug. Hopefully we'll fix it in some future round of work.

pyrello’s picture

I am getting a similar error:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'new.uc_countries' doesn't exist: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {old.uc_orders} uo LEFT OUTER JOIN {uc_countries} uc ON uo.billing_country = uc.country_id LEFT OUTER JOIN {uc_zones} uz ON uo.billing_zone = uz.zone_id WHERE (uo.order_status <> :db_condition_placeholder_0) ) subquery; Array ( [:db_condition_placeholder_0] => in_checkout ) in MigrateSourceSQL->computeCount() (line 215 of /path/to/site/sites/all/modules/migrate/plugins/sources/sql.inc).

Is this related to this section of code, starting on line 28 of customer_billing_profile.inc?:

    // Create a MigrateSource object, which manages retrieving the input data.
    $connection = commerce_migrate_ubercart_get_source_connection();

    $query = $connection->select('uc_orders', 'uo');
    $query->leftJoin('uc_countries', 'uc', 'uo.billing_country = uc.country_id');
    $query->leftJoin('uc_zones', 'uz', 'uo.billing_zone = uz.zone_id');
    $query->fields('uo', array('order_id', 'billing_first_name', 'billing_last_name',
                                'billing_company', 'billing_street1',
                                'billing_city', 'billing_postal_code',
                                'delivery_first_name', 'delivery_last_name',
                                'delivery_company', 'delivery_street1',
                                'delivery_city', 'delivery_postal_code',
                                'created'));
    $query->fields('uc', array('country_iso_code_2'));
    $query->fields('uz', array('zone_code'));
    $query->condition('uo.order_status', 'in_checkout', '<>');
    // If we're mapping users AND there's no migration class specified for it,
    // query for uid.
    if (variable_get('commerce_migrate_ubercart_user_map_ok', FALSE)) {
      $query->addField('uo', 'uid', 'uid');
    }

    $this->source = new MigrateSourceSQL($query, array(), NULL, array('map_joinable' => FALSE));

That is the only reference to uc_countries I can find. The error above references the MigrateSourceSQL class (which is on line 50 of the above code snippet). It seems that things are getting messed up because the column names aren't the same between ubercart and commerce, but I don't see a clear way to correct this.

rfay’s picture

No, it's just inadequate UI. You have to configure Commerce Migrate Ubercart before visiting the Migrate page.

pyrello’s picture

@rfay - thanks for the quick reply. I am trying to adapt some of the code from the commerce_migrate_ubercart module in my own custom module. What setting on the Commerce Migrate Ubercart settings page needs to be set for this to work correctly? I understand that this is outside the scope of the module and the type of question that the issue queue is for, but if you knew, it would save me some time digging and I would greatly appreciate it.

Thanks!

rfay’s picture

@pyrello, you need to fill in the location of the source database. Try it out.

pyrello’s picture

To get this to work, I had to add an additional array of database connection info to my settings.php file and now I can connect.

rfay’s picture

Project: Commerce Migrate » Commerce Migrate Ubercart
Component: Commerce Migrate Ubercart » Code
dwkitchen’s picture

Issue summary: View changes
Status: Active » Closed (outdated)