In order to try Feeds, I did the ff:

  1. Uploaded Job Scheduler 7.x-2.0-alpha2
  2. On Modules UI, enabled Job Scheduler. Saved configuration.
  3. Uploaded Feeds 7.x-2.0-alpha3.
  4. On Modules UI, enabled Feeds. Saved configuration.
  5. On Modules UI, enabled Feeds Admin UI and Feeds Import. Saved configuration.

I was able to play around with the settings of a new node import feed after that, but did not actually perform one. It was the end of the day so I stopeed at that point.

First thing the next morning, I ran cron, and the following error showed:

PDOException SQLSTATE[42502]: Base table or view not found: 1146 Table 'mysite_drupalroot.job_schedule' doesn't exist: UPDATE {job_schedule} SET scheduled=:db_update_placehlder_0 WHERE (scheduled <:db_condition_placeholder ... in job_scheduler_cron() (line 53 of public_html/drupalroot/sites/all/modules/job_scheduler/job_scheduler.module).

Because of this, I did not attempt anymore to proceed with creating an import feed.

Other modules installed at the time:

  • advanced_help
  • backup_migrate
  • ctools
  • token
  • views
  • webform

A few notes:
I think the requirement of Job Scheduler should be announced on the Feeds project homepage, as it is a separate module that requires a separate download and is also still in alpha--all facts a potential user will want to take into consideration. Just a suggestion.

Thanks much.

CommentFileSizeAuthor
#5 feeds table.tar_.gz1.66 KBsantam

Comments

santam’s picture

Same error here .. any solutions?

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.feeds_log' doesn't exist: DELETE FROM {feeds_log} WHERE (request_time < :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 1297619364 ) in feeds_cron() (line 43 of /home/clients/websites/w_isocen/public_html/isocen/sites/all/modules/feeds/feeds.module).
Cron runs fine after disabling and uninstalling the feeds module

santam’s picture

After spending almost the whole weekend I think I have sorted out the issue. I guess the problem is that the installation fails to create tables required by the module. Any idea why this is happening?

I tried out installing the module in a fresh install of drupal 7 with ctools and views installed in addition to job_scheduler which I installed and enabled first this time. The error that appears on enabling feeds and feeds UI is

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes: CREATE TABLE {feeds_item} ( `entity_type` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'The entity type.', `entity_id` INT unsigned NOT NULL COMMENT 'The imported entity’s serial id.', `id` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'The id of the importer that created this item.', `feed_nid` INT unsigned NOT NULL COMMENT 'Node id of the source, if available.', `imported` INT NOT NULL DEFAULT 0 COMMENT 'Import date of the feed item, as a Unix timestamp.', `url` TEXT NOT NULL COMMENT 'Link to the feed item.', `guid` TEXT NOT NULL COMMENT 'Unique identifier for the feed item.', `hash` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'The hash of the source item.', PRIMARY KEY (`entity_type`, `entity_id`), INDEX `id` (`id`), INDEX `feed_nid` (`feed_nid`), INDEX `lookup_url` (`entity_type`, `id`, `feed_nid`, `url`(255)), INDEX `lookup_guid` (`entity_type`, `id`, `feed_nid`, `guid`(255)), INDEX `global_lookup_url` (`entity_type`, `url`(255)), INDEX `global_lookup_guid` (`entity_type`, `guid`(255)), INDEX `imported` (`imported`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Tracks items such as nodes, terms, users.'; Array ( ) in db_create_table() (line 2588 of /home/clients/websites/w_test2/public_html/test2/includes/database/database.inc).

After this I went ahead and tried to create the feed_items table directly on PHPMyAdmin. This is the mysql table I use. Note that my provider gives MyISAM not Innodb

CREATE TABLE IF NOT EXISTS `feed_items` (
`entity_type` VARCHAR(64) NOT NULL DEFAULT '' COMMENT 'The entity type.', 
`entity_id` INT unsigned NOT NULL COMMENT 'The imported entity’s serial id.',
`id` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'The id of the importer that created this item.',
`feed_nid` INT unsigned NOT NULL COMMENT 'Node id of the source, if available.', 
`imported` INT NOT NULL DEFAULT 0 COMMENT 'Import date of the feed item, as a Unix timestamp.', `url` TEXT NOT NULL COMMENT 'Link to the feed item.',
`guid` TEXT NOT NULL COMMENT 'Unique identifier for the feed item.',
`hash` VARCHAR(32) NOT NULL DEFAULT '' COMMENT 'The hash of the source item.', 
PRIMARY KEY (`entity_type`, `entity_id`), 
INDEX `id` (`id`), 
INDEX `feed_nid` (`feed_nid`),
INDEX `lookup_url` (`entity_type`, `id`, `feed_nid`, `url`(255)), 
INDEX `lookup_guid` (`entity_type`, `id`, `feed_nid`, `guid`(255)), 
INDEX `global_lookup_url` (`entity_type`, `url`(255)), INDEX `global_lookup_guid` (`entity_type`, `guid`(255)), 
INDEX `imported` (`imported`) 
) ENGINE = MyISAM DEFAULT CHARACTER SET utf8 COMMENT 'Tracks items such as nodes, terms, users.';

However the same error message came that is to say that index length exceeded 1000 bytes. I ultimately created the table without the three indexes :
INDEX `lookup_url` (`entity_type`, `id`, `feed_nid`, `url`(255)),
INDEX `lookup_guid` (`entity_type`, `id`, `feed_nid`, `guid`(255)),
INDEX `global_lookup_url` (`entity_type`, `url`(255)), INDEX `global_lookup_guid` (`entity_type`, `guid`(255)),

Went back and refreshed the page for the modules and disabled the feeds module and then reenabled it agian. This time the error was

DatabaseSchemaObjectExistsException: Table feeds_importer already exists. in DatabaseSchema->createTable() (line 630 of /home/clients/websites/w_test2/public_html/test2/includes/database/schema.inc).

Which probably means that its throwing an exception as the table already exists :-)
Went back to modules found that feeds was enabled despite the error. Enabled the feeds admin UI module also .. enabling proceeded well.

Ran cron and up pops the error
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.feeds_log' doesn't exist: DELETE FROM {feeds_log} WHERE (request_time < :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 1297755709 ) in feeds_cron() (line 43 of /home/clients/websites/w_test2/public_html/test2/sites/all/modules/feeds/feeds.module).

went back 2 php my admin 3 tables from feed:
feeds_importer
feeds_source
feed_items

thought of creating the log table too but did not know what to put in there :-(

molave’s picture

Hi santam, and thanks for this helpful input. I can understand the concepts being discussed, but as a non-programmer, I get lost with the details, especially the syntax.

To give some context, this module was the main hope for me to be able to import multiple nodes into Drupal 7, as a replacement for Node Import. Because of this issue, however, I was forced to abandon D7---at least for the time being---and retreat back to Drupal 6.

santam’s picture

Actually I am no programmer either. One thing I do understand is that there are probably 5 database tables that should be created. I have 3 in place but no way of knowing what the other two are. I have also disabled the module for now and am hoping for some more inputs. Even if I get an idea about what the fields in the table are we could actually overcome this issue quite simply

santam’s picture

StatusFileSize
new1.66 KB

Finally got all the databases prepared and now the feeds module is working. I am attaching the database sql schema below as a tar file. You just need to extract it using winrar if you are on windows. The schema syntax is as below :

-- phpMyAdmin SQL Dump
-- version 3.3.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1:4469
-- Generation Time: Feb 23, 2011 at 09:10 PM
-- Server version: 5.1.41
-- PHP Version: 5.2.13

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `drupal`
--

-- --------------------------------------------------------

--
-- Table structure for table `feeds_importer`
--

CREATE TABLE IF NOT EXISTS `feeds_importer` (
`id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Id of the fields object.',
`config` text COMMENT 'Configuration of the feeds object.',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Configuration of feeds objects.';

-- --------------------------------------------------------

--
-- Table structure for table `feeds_item`
--

CREATE TABLE IF NOT EXISTS `feeds_item` (
`entity_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'The entity type.',
`entity_id` int(10) unsigned NOT NULL COMMENT 'The imported entity’s serial id.',
`id` varchar(128) NOT NULL DEFAULT '' COMMENT 'The id of the importer that created this item.',
`feed_nid` int(10) unsigned NOT NULL COMMENT 'Node id of the source, if available.',
`imported` int(11) NOT NULL DEFAULT '0' COMMENT 'Import date of the feed item, as a Unix timestamp.',
`url` text NOT NULL COMMENT 'Link to the feed item.',
`guid` text NOT NULL COMMENT 'Unique identifier for the feed item.',
`hash` varchar(32) NOT NULL DEFAULT '' COMMENT 'The hash of the source item.',
PRIMARY KEY (`entity_type`,`entity_id`),
KEY `id` (`id`),
KEY `feed_nid` (`feed_nid`),
KEY `lookup_url` (`entity_type`,`id`,`feed_nid`,`url`(100)),
KEY `lookup_guid` (`entity_type`,`id`,`feed_nid`,`guid`(100)),
KEY `global_lookup_url` (`entity_type`,`url`(100)),
KEY `global_lookup_guid` (`entity_type`,`guid`(100)),
KEY `imported` (`imported`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Tracks items such as nodes, terms, users.';

-- --------------------------------------------------------

--
-- Table structure for table `feeds_log`
--

CREATE TABLE IF NOT EXISTS `feeds_log` (
`flid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Primary Key: Unique feeds event ID.',
`id` varchar(128) NOT NULL DEFAULT '' COMMENT 'The id of the importer that logged the event.',
`feed_nid` int(10) unsigned NOT NULL COMMENT 'Node id of the source, if available.',
`log_time` int(11) NOT NULL DEFAULT '0' COMMENT 'Unix timestamp of when event occurred.',
`request_time` int(11) NOT NULL DEFAULT '0' COMMENT 'Unix timestamp of the request when the event occurred.',
`type` varchar(64) NOT NULL DEFAULT '' COMMENT 'Type of log message, for example "feeds_import"."',
`message` longtext NOT NULL COMMENT 'Text of log message to be passed into the t() function.',
`variables` longblob NOT NULL COMMENT 'Serialized array of variables that match the message string and that is passed into the t() function.',
`severity` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'The severity level of the event; ranges from 0 (Emergency) to 7 (Debug)',
PRIMARY KEY (`flid`),
KEY `id` (`id`),
KEY `id_feed_nid` (`id`,`feed_nid`),
KEY `request_time` (`request_time`),
KEY `log_time` (`log_time`),
KEY `type` (`type`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Table that contains logs of feeds events.' AUTO_INCREMENT=5 ;

-- --------------------------------------------------------

--
-- Table structure for table `feeds_push_subscriptions`
--

CREATE TABLE IF NOT EXISTS `feeds_push_subscriptions` (
`domain` varchar(128) NOT NULL DEFAULT '' COMMENT 'Domain of the subscriber. Corresponds to an importer id.',
`subscriber_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of the subscriber. Corresponds to a feed nid.',
`timestamp` int(11) NOT NULL DEFAULT '0' COMMENT 'Created timestamp.',
`hub` text NOT NULL COMMENT 'The URL of the hub endpoint of this subscription.',
`topic` text NOT NULL COMMENT 'The topic URL (feed URL) of this subscription.',
`secret` varchar(128) NOT NULL DEFAULT '' COMMENT 'Shared secret for message authentication.',
`status` varchar(64) NOT NULL DEFAULT '' COMMENT 'Status of subscription.',
`post_fields` text COMMENT 'Fields posted.',
PRIMARY KEY (`domain`,`subscriber_id`),
KEY `timestamp` (`timestamp`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='PubSubHubbub subscriptions.';

-- --------------------------------------------------------

--
-- Table structure for table `feeds_source`
--

CREATE TABLE IF NOT EXISTS `feeds_source` (
`id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Id of the feed configuration.',
`feed_nid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Node nid if this particular source is attached to a feed node.',
`config` text COMMENT 'Configuration of the source.',
`source` text NOT NULL COMMENT 'Main source resource identifier. E. g. a path or a URL.',
`state` longtext COMMENT 'State of import or clearing batches.',
`fetcher_result` longtext COMMENT 'Cache for fetcher result.',
`imported` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Timestamp when this source was imported last.',
PRIMARY KEY (`id`,`feed_nid`),
KEY `id` (`id`),
KEY `feed_nid` (`feed_nid`),
KEY `id_source` (`id`,`source`(128))
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Source definitions for feeds.';


The issue is not with the feeds module on the whole. Its also the fault of the database i.e. mysql if you are not having InnoDB as the engine type. I had installed drupal on my own desktop and enabled innodb in mysql and then installed the module. There is something called php safe mode which frankly I dont understand but it may be the reason why tables are not getting created. 
Another thing to point out here is that feeds_item is not getting created here as the query length is exceeding 1000 Bytes and that may be interrupting the installation process for the rest of the database tables. Its a limitation of utf-8 encoding type used in the database and can be rectified if you make the encoding as latin1. Another option that I got from the MySQL support forum was trim the number of characters in the query. For example:

INDEX `lookup_url` (`entity_type`, `id`, `feed_nid`, `url`(255)),
INDEX `lookup_guid` (`entity_type`, `id`, `feed_nid`, `guid`(255)),
INDEX `global_lookup_url` (`entity_type`, `url`(255)), INDEX `global_lookup_guid` (`entity_type`, `guid`(255)),

here i replaced the 255 with 100 and the table got created while earlier it was not getting created at all.

This is the exact error that happens when you try to create the feeds_item table.

How to add this table to your database.
Go to phpmyadmin from your cpanel. Select your drupal database. Where the list of table appears you will see a tab that says SQL . Click on it you will get a text box. Paste the contents of the sql query from the attached file or the syntax above and you are done. Your 5 tables should get created and the module will start to work.

molave’s picture

Hi again santam,

Pardon the long silence. Was occupied with other work.

I finally got to try your solution on a localhost test site, and it worked! Thank you very much for sharing your documentation on the issue. I have since created a fresh install of Drupal 7 on a different webhost. Strangely, this time around, the Feeds module installed without a hitch, so no need for the MySQL workaround.

Sheesh. What gremlins there are in the code, I cannot tell... But I certainly appreciate the help that's been offered.

Cheers!

ryan osītis’s picture

subscribe

no_idea_yet’s picture

@ santam

Thanks for that, brand new install and I had to use your sql to create item log and push_subscriptions.

santam’s picture

Did you perchance do it on webenabled?

no_idea_yet’s picture

G'day santam

"webenabled"?

If you mean webenabled.com then nope, on my VPS (CentOs 5.5, Apache 2.2, PHP 5.2.17 and MySQL 5.0.92) using Git.

santam’s picture

If you have time could you experiment with another install after having a mysql database with latin1 encoding that can probably overcome the install issues. I dont have access to that functionality so was wondering if anyone would be williing to try that.

Niklas Fiekas’s picture

Status: Active » Closed (duplicate)

Closed as a duplicate of #1044882: table feeds_item could not be created pdo exception key was too long, which is, of all the issues about this problem, the one chosen by a fair dice roll.

dess5’s picture

Many Thanks your are Great, Helpful code