shlomi-noach / openarkkit

Automatically exported from code.google.com/p/openarkkit
24 stars 16 forks source link

oak-online-alter-table fails creating triggers #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure if I'm doing something wrong or there is an actual issue.

mysql --version
mysql  Ver 14.14 Distrib 5.1.56, for redhat-linux-gnu (x86_64) using readline 
5.1

rpm -qa | grep openark
openark-kit-180-1

oak-online-alter-table --database=teamlab --table=activities --alter="ADD 
KEY(thing_id, thing_type, contact_id)" --user=root --ask-pass 
--socket=/var/lib/mysql/mysql.sock --chunk-size=5000 --sleep=1000 --verbose
-- Connecting to MySQL
Password: 
-- Table teamlab.activities is of engine innodb
-- Checking for UNIQUE columns on teamlab.activities, by which to chunk
-- Possible UNIQUE KEY column names in teamlab.activities:
-- - id
-- Table teamlab.__oak_activities has been created
-- Table teamlab.__oak_activities has been altered
-- Checking for UNIQUE columns on teamlab.__oak_activities, by which to chunk
-- Possible UNIQUE KEY column names in teamlab.__oak_activities:
-- - id
-- Checking for UNIQUE columns on teamlab.activities, by which to chunk
-- - Found following possible unique keys:
-- - id (int)
-- Chosen unique key is 'id'
-- Shared columns: thing_type, user_id, email_id, updated_field, created_at, 
after, thing_id, updated_at, contact_id, action, mongo_contact_id, 
college_team_id, id, before
-- Created AD trigger
exceptions.Exception (1064, "You have an error in your SQL syntax; check the 
manual that corresponds to your MySQL server version for the right syntax to 
use near 'before) VALUES (NEW.thing_type, NEW.user_id, NEW.email_id, 
NEW.updated_field, NE' at line 5")
-- ERROR: Errors found. Initiating cleanup
-- Tables unlocked
-- Table teamlab.__oak_activities was found and dropped
-- Dropped custom trigger activities_AD_oak
-- ERROR: (1064, "You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use near 
'before) VALUES (NEW.thing_type, NEW.user_id, NEW.email_id, NEW.updated_field, 
NE' at line 5")
Traceback (most recent call last):
  File "/usr/local/bin/oak-online-alter-table", line 957, in ?
    exit_with_error(err)
  File "/usr/local/bin/oak-online-alter-table", line 856, in exit_with_error
    exit(1)
TypeError: 'str' object is not callable

Original issue reported on code.google.com by michael....@gmail.com on 24 Jan 2013 at 5:57

GoogleCodeExporter commented 9 years ago
Seems to me as though you have a column called "before" ? Can you verify?
I do believe I already have a fix for that. Let me check.

Original comment by shlomi.n...@gmail.com on 25 Jan 2013 at 5:49

GoogleCodeExporter commented 9 years ago
Yes there are before and after columns on that table.

Original comment by michael....@gmail.com on 25 Jan 2013 at 3:27

GoogleCodeExporter commented 9 years ago
So these names are reserved words; I'll attach code which correctly qualifies 
them

Original comment by shlomi.n...@gmail.com on 25 Jan 2013 at 5:20

GoogleCodeExporter commented 9 years ago
Hi Shlomi - I wasn't sure if you attached a fix and I missed it or if you 
hadn't gotten to it yet.

Thanks- Michael

Original comment by michael....@gmail.com on 28 Jan 2013 at 4:36

GoogleCodeExporter commented 9 years ago
Hi - I didn't. But here it is:
Please try it and let me know if this fixes the problem.

Original comment by shlomi.n...@gmail.com on 28 Jan 2013 at 5:44

Attachments:

GoogleCodeExporter commented 9 years ago
Looks like that did the trick. Thanks again

Original comment by michael....@gmail.com on 28 Jan 2013 at 5:51

GoogleCodeExporter commented 9 years ago
Good. Will need to release soon. This is a long due fix.

Original comment by shlomi.n...@gmail.com on 28 Jan 2013 at 5:56

GoogleCodeExporter commented 9 years ago
Fixed (prior to revision 193).

Original comment by shlomi.n...@gmail.com on 6 May 2013 at 7:29