-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execute several statements in a query (with semi-colon) #1063
Comments
This is in fact a cassandra limitation in that one statement can only
execute one query from my experience. Cqlsh works because it is splitting
the statement into multi queries and executing them. I think to support
this migrate should split the statements and execute them.
…On Fri, 16 Feb 2018 at 7:05 pm, Yannick Buron ***@***.***> wrote:
Hello,
I'd like to use https://github.com/mattes/migrate for managing migrations
in my project. It works well, but I can't define several statements in one
migration file without an error.
After some investigations, it seems the problems is because gocql is
itself not able to execute several statements in one query. Here is the
line where gocql is executed and my error
https://github.com/mattes/migrate/blob/master/database/cassandra/cassandra.go#L141
.
migration failed in line 0: CREATE TABLE IF NOT EXISTS requirement ( id
text, parent_id text, sequence int, computation text, weight int, state
text, can_have_children boolean, PRIMARY KEY(id) ); CREATE INDEX IF NOT
EXISTS requirement_parent_id ON requirement(parent_id); (details: line 11:0
mismatched input 'CREATE' expecting EOF (...PRIMARY KEY(id));[CREATE]...))
I reproduce the error if I try some random statement in gocql with a
semicolon. Is there any reason to have such limitation ? Cqlsh allow to
chain statement without any problem so it does not seems to be a Cassandra
limitation. This is quite troublesome in my use case because this will
force me to have dozens of migration files in my project. What do you think
?
Thank you for your insight and for the awesome work !
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1063>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAIpSUh-XCHbV7liO1JbFe1ddhi71uUks5tVdF0gaJpZM4SIyPJ>
.
|
Hello @Zariel Thanks for the explanation. In this case I shall close this issue and link it to the one on the migrate project mattes/migrate#338. Have a nice day! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I'd like to use https://github.com/mattes/migrate for managing migrations in my project. It works well, but I can't define several statements in one migration file without an error.
After some investigations, it seems the problems is because gocql is itself not able to execute several statements in one query. Here is the line where gocql is executed and my error https://github.com/mattes/migrate/blob/master/database/cassandra/cassandra.go#L141.
migration failed in line 0: CREATE TABLE IF NOT EXISTS requirement ( id text, parent_id text, sequence int, computation text, weight int, state text, can_have_children boolean, PRIMARY KEY(id) ); CREATE INDEX IF NOT EXISTS requirement_parent_id ON requirement(parent_id); (details: line 11:0 mismatched input 'CREATE' expecting EOF (...PRIMARY KEY(id));[CREATE]...))
I reproduce the error if I try some random statement in gocql with a semicolon. Is there any reason to have such limitation ? Cqlsh allow to chain statement without any problem so it does not seems to be a Cassandra limitation. This is quite troublesome in my use case because this will force me to have dozens of migration files in my project. What do you think ?
Thank you for your insight and for the awesome work !
The text was updated successfully, but these errors were encountered: