Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Getting Error when converting bit(1) NOT NULL DEFAULT b'0', #70

Open
raymatos opened this issue Sep 16, 2014 · 0 comments
Open

Getting Error when converting bit(1) NOT NULL DEFAULT b'0', #70

raymatos opened this issue Sep 16, 2014 · 0 comments

Comments

@raymatos
Copy link

here is the stack trace

Traceback (most recent call last):
  File "/usr/local/bin/py-mysql2pgsql", line 5, in <module>
    pkg_resources.run_script('py-mysql2pgsql==0.1.6', 'py-mysql2pgsql')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 489, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1207, in run_script
    execfile(script_filename, namespace, namespace)
  File "/Library/Python/2.7/site-packages/py_mysql2pgsql-0.1.6-py2.7.egg/EGG-INFO/scripts/py-mysql2pgsql", line 38, in <module>
    mysql2pgsql.Mysql2Pgsql(options).convert()
  File "/Library/Python/2.7/site-packages/py_mysql2pgsql-0.1.6-py2.7.egg/mysql2pgsql/mysql2pgsql.py", line 37, in convert
    Converter(reader, writer, self.file_options, self.run_options.verbose).convert()
  File "/Library/Python/2.7/site-packages/py_mysql2pgsql-0.1.6-py2.7.egg/mysql2pgsql/lib/converter.py", line 32, in convert
    self.writer.write_table(table)
  File "/Library/Python/2.7/site-packages/py_mysql2pgsql-0.1.6-py2.7.egg/mysql2pgsql/lib/__init__.py", line 91, in decorated_function
    ret = f(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/py_mysql2pgsql-0.1.6-py2.7.egg/mysql2pgsql/lib/postgres_file_writer.py", line 65, in write_table
    table_sql, serial_key_sql = super(PostgresFileWriter, self).write_table(table)
  File "/Library/Python/2.7/site-packages/py_mysql2pgsql-0.1.6-py2.7.egg/mysql2pgsql/lib/postgres_writer.py", line 230, in write_table
    primary_keys, serial_key, maxval, columns = self.table_attributes(table)
  File "/Library/Python/2.7/site-packages/py_mysql2pgsql-0.1.6-py2.7.egg/mysql2pgsql/lib/postgres_writer.py", line 206, in table_attributes
    columns.write('  %s,\n' % self.column_description(column))
  File "/Library/Python/2.7/site-packages/py_mysql2pgsql-0.1.6-py2.7.egg/mysql2pgsql/lib/postgres_writer.py", line 26, in column_description
    return '"%s" %s' % (column['name'], self.column_type_info(column))
  File "/Library/Python/2.7/site-packages/py_mysql2pgsql-0.1.6-py2.7.egg/mysql2pgsql/lib/postgres_writer.py", line 126, in column_type_info
    default, column_type = get_type(column)
  File "/Library/Python/2.7/site-packages/py_mysql2pgsql-0.1.6-py2.7.egg/mysql2pgsql/lib/postgres_writer.py", line 62, in get_type
    default = (" DEFAULT %s" % ('true' if int(column['default']) == 1 else 'false')) if t(default) else None
ValueError: invalid literal for int() with base 10: "b'0'"

mysql schema

CREATE TABLE `campaigns` (
  `name` varchar(255) NOT NULL,
  `description` text,
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `xAdCampaingID` varchar(50) DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `deleted_at` datetime DEFAULT NULL,
  `updated_by` int(11) unsigned DEFAULT NULL,
  `created_by` int(11) unsigned NOT NULL,
  `guid` varchar(255) DEFAULT NULL,
  `launch_date` datetime NOT NULL,
  `end_date` datetime NOT NULL,
  `summary_notes` text NOT NULL,
  `attribution_view_through_max_window` float DEFAULT '30',
  `attribution_click_through_max_window` float DEFAULT '30',
  `ui_kpi_impression_count` double(11,2) DEFAULT '0.00',
  `ui_kpi_conversion_rate` double(11,2) DEFAULT '0.00',
  `ui_kpi_click_rate` double(11,2) DEFAULT '0.00',
  `ui_kpi_reach_rate` double(11,2) DEFAULT '0.00',
  `ui_kpi_engagement_rate` double(11,2) NOT NULL DEFAULT '0.00',
  `ui_kpi_video_rate` double(11,2) DEFAULT '0.00',
  `actual_impression_count` int(11) NOT NULL DEFAULT '0',
  `actual_click_count` int(11) NOT NULL DEFAULT '0',
  `actual_expand_count` int(11) NOT NULL DEFAULT '0',
  `actual_engagement_count` int(11) NOT NULL DEFAULT '0',
  `ui_kpi_expand_rate` double(11,2) DEFAULT '0.00',
  `actual_click_rate` double(11,2) NOT NULL DEFAULT '0.00',
  `actual_expand_rate` double(11,2) NOT NULL DEFAULT '0.00',
  `actual_engagement_rate` double(11,2) NOT NULL DEFAULT '0.00',
  `expected_impressions` int(11) DEFAULT '0',
  `advertiser_id` int(11) unsigned DEFAULT NULL,
  `is_madison` tinyint(11) NOT NULL DEFAULT '0',
  `instance_id` int(11) unsigned NOT NULL,
  `agency_id` int(11) unsigned DEFAULT NULL,
  `brand_id` int(11) unsigned DEFAULT NULL,
  `budget` decimal(20,2) DEFAULT NULL,
  `currency` varchar(255) DEFAULT 'USD',
  `deleted_by` int(11) unsigned DEFAULT NULL,
  `timezone` varchar(100) NOT NULL DEFAULT 'America/New_York',
  `indexed_at` datetime DEFAULT NULL,
  `actual_conversion_rate` double(10,2) unsigned NOT NULL DEFAULT '0.00',
  `actual_conversion_count` int(11) NOT NULL DEFAULT '0',
  `actual_reach_rate` double(10,2) unsigned NOT NULL DEFAULT '0.00',
  `actual_reach_count` double(11,2) NOT NULL DEFAULT '0.00',
  `actual_video_rate` double(10,2) unsigned NOT NULL DEFAULT '0.00',
  `actual_video_count` double(11,2) NOT NULL DEFAULT '0.00',
  `insertion_order` varchar(100) NOT NULL DEFAULT '',
  `impression_enabled` bit(1) NOT NULL DEFAULT b'0',
  `click_enabled` int(11) unsigned NOT NULL DEFAULT '0',
  `expand_enabled` int(11) unsigned NOT NULL DEFAULT '0',
  `engagement_enabled` bit(1) NOT NULL DEFAULT b'0',
  `conversion_enabled` bit(1) NOT NULL DEFAULT b'0',
  `reach_enabled` bit(1) NOT NULL DEFAULT b'0',
  `video_enabled` bit(1) NOT NULL DEFAULT b'0',
  `budget_enabled` bit(1) NOT NULL DEFAULT b'0',
  `metrics_updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `old_attribution_id` int(11) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_campaign_deleted` (`deleted_at`) USING BTREE,
  KEY `idx_guid` (`guid`) USING BTREE,
  KEY `updated_by` (`updated_by`),
  KEY `created_by` (`created_by`),
  KEY `deleted_by` (`deleted_by`),
  KEY `instance_id` (`instance_id`),
  KEY `agency_id` (`agency_id`),
  KEY `advertiser_id` (`advertiser_id`),
  KEY `campaigns_ibfk_7` (`brand_id`),
  KEY `old_attribution_id` (`old_attribution_id`),
  CONSTRAINT `campaigns_ibfk_1` FOREIGN KEY (`updated_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `campaigns_ibfk_2` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `campaigns_ibfk_3` FOREIGN KEY (`deleted_by`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `campaigns_ibfk_5` FOREIGN KEY (`instance_id`) REFERENCES `instances` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `campaigns_ibfk_6` FOREIGN KEY (`agency_id`) REFERENCES `agencies` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `campaigns_ibfk_7` FOREIGN KEY (`brand_id`) REFERENCES `advertiser_brands` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `campaigns_ibfk_8` FOREIGN KEY (`advertiser_id`) REFERENCES `advertisers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1274 DEFAULT CHARSET=utf8;
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant