1290 Error on Google Cloud SQL - mysql

I just started getting this Error today while using MySQL workbench, and noticed it showing up in my application as far back as saturday. Anyone else getting it?
Have any idea what might be causing it?
ERROR
Error Code: 1290. The MySQL server is running with the --read-only option so it cannot execute this statement
Running just a simple insert generates the error. Eg..
INSERT INTO Job1111.SubsWeld
(fk_SubmissionId, WeldSpool1, WeldSpool2, WeldDrawingNumber, WeldLineNumber, WeldSheetNumber, WeldTimeInForm, WeldLineSpec, WeldNumber, WeldStencil, WeldSize, WeldThickness, WeldType, WeldPosition, WeldMaterial, WeldProcedure, WeldComplete, WeldShared, WeldPercentCompleted, WeldRework, ActivityType, Rev)
VALUES ('66', '5990-363-A', '5990-363-B', 'V-0020-3', '12-V-0020', '3', '0', 'A', '1059', '1059', '24.00', 'Sch. 40', 'BW', '5G', 'CS', '1013 Rev2', '1', '0', '100', '0', '22', '0');

Related

You have an error in your SQL syntax when using docker exec rest api

I try to run a mysql statement via docker exec api -> https://docs.docker.com/engine/api/v1.41/#operation/ContainerExec
My Statement looks like this
{
"AttachStdin": false,
"AttachStdout": true,
"AttachStderr": true,
"DetachKeys": "ctrl-p,ctrl-q",
"Tty": false,
"Cmd": [
"bin/bash","-c", "mysql -uroot -ptesttest -e 'INSERT INTO `mandator_1`.`terminal` (`serialNumber`, `name`, `isActive`, `status`, `profileId`, `businessId`, `divisionId`, `ipAddress`, `groupId`, `setupVersion`, `macAddress`, `authType`) VALUES ('54321', '54321', '1', NULL, '1', '1', NULL, '172.45.17.197', '1', NULL, 'E4-F1-D3-FD', '2');' mandator_1"
]
}
but when i run the statement i get an error
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.17.197, 1, NULL, E4-F1-D3-FD, 2)' at line 1
i think my escaping is wrong but at which point?
Try to change quote by double quote:
VALUES (\"54321\", \"54321\", \"1\", ...., \"2\");

How can I retrieve problem and host name using Zabbix API?

I want to retrieve data from Zabbix API using ZabbixAPI.
So I made API JSON like below.
zabbixapi.problem.get(time_from=time_from,
time_till=time_till,
selectHosts = ["host","name"],
sortorder = "DESC",
output = "extend",
monitored = 1)
Result has no host information.
Result is below.
[{'eventid': '401154', 'source': '0', 'object': '0', 'objectid': '18265', 'clock': '1569375897', 'ns': '887610916', 'r_eventid': '0', 'r_clock': '0', 'r_ns': '0', 'correlationid': '0', 'userid': '0', 'name': 'Optical power is low on port 7', 'acknowledged': '0', 'severity': '3', 'suppressed': '0'}, {'eventid': '401456', 'source': '0', 'object': '0', 'objectid': '30714', 'clock': '1569401534', 'ns': '909385820', 'r_eventid': '0', 'r_clock': '0', 'r_ns': '0', 'correlationid': '0', 'userid': '0', 'name': 'Optical power is low on port 33', 'acknowledged': '0', 'severity': '3', 'suppressed': '0'}]
I think "selectHosts" does not work.
How can I get problem with host information?
According to the documentation, problem.get does not have a selectHosts parameter.
Every item of the returned object has a eventid value, you can use it in a event.get call, which supports selectHosts.
Or you can do a single event.get call with selectHosts plus a filter for value = 1, that corresponds to the "Problem" state (see the documentation for the event object)
Using curl.
To get problem event ids:
curl -H "Content-Type: application/json-rpc" -X POST my_zabbix_url -d '{"jsonrpc": "2.0","method": "problem.get","params": {},"auth": "my_token","id": 0}'
To get hosts based on event id:
curl -H "Content-Type: application/json-rpc" -X POST my_zabbix_url -d '{"jsonrpc": "2.0","method": "event.get","params": {"selectHosts": ["host","name"],"output": "extend","select_acknowledges": "extend","objectids": "my_event_object_id","sortfield": ["clock", "eventid"],"sortorder": "DESC"},"auth": "my_token","id": 0}'

JHipster with MySQL back-end fails on first start with "table does not comply with the requirements by an external plugin"

I'm getting the following error when I try to start a new JHipster app using MySQL as the database:
2019-07-30 09:55:40.583 ERROR 35895 --- [-service-task-1] i.g.j.c.liquibase.AsyncSpringLiquibase : Liquibase could not start correctly, your database is NOT ready: The table does not comply with the requirements by an external plugin. [Failed SQL: INSERT INTO compose.DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('00000000000001', 'jhipster', 'config/liquibase/changelog/00000000000000_initial_schema.xml', NOW(), 1, '8:c5bfc567913b118109a43e981cd02883', 'createTable tableName=jhi_user; createTable tableName=jhi_authority; createTable tableName=jhi_user_authority; addPrimaryKey tableName=jhi_user_authority; addForeignKeyConstraint baseTableName=jhi_user_authority, constraintName=fk_authority_name, ...', '', 'EXECUTED', NULL, NULL, '3.6.3', '4491329886')]
liquibase.exception.DatabaseException: The table does not comply with the requirements by an external plugin. [Failed SQL: INSERT INTO compose.DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('00000000000001', 'jhipster', 'config/liquibase/changelog/00000000000000_initial_schema.xml', NOW(), 1, '8:c5bfc567913b118109a43e981cd02883', 'createTable tableName=jhi_user; createTable tableName=jhi_authority; createTable tableName=jhi_user_authority; addPrimaryKey tableName=jhi_user_authority; addForeignKeyConstraint baseTableName=jhi_user_authority, constraintName=fk_authority_name, ...', '', 'EXECUTED', NULL, NULL, '3.6.3', '4491329886')]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:356)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:57)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:125)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:109)
at liquibase.changelog.StandardChangeLogHistoryService.setExecType(StandardChangeLogHistoryService.java:384)
at liquibase.database.AbstractJdbcDatabase.markChangeSetExecStatus(AbstractJdbcDatabase.java:1086)
at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:64)
at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:83)
at liquibase.Liquibase.update(Liquibase.java:202)
at liquibase.Liquibase.update(Liquibase.java:179)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:353)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:305)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.initDb(AsyncSpringLiquibase.java:119)
at io.github.jhipster.config.liquibase.AsyncSpringLiquibase.lambda$afterPropertiesSet$0(AsyncSpringLiquibase.java:94)
at io.github.jhipster.async.ExceptionHandlingAsyncTaskExecutor.lambda$createWrappedRunnable$1(ExceptionHandlingAsyncTaskExecutor.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLException: The table does not comply with the requirements by an external plugin.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:782)
at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:666)
at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:95)
at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:352)
... 17 common frames omitted
It looks like it's failing on a liquibase step. Any ideas why this is happening?
Liquibase does not create the DATABASECHANGELOG table with the required primary key. Try stopping JHipster, running the following SQL commands against your mysql database, and then restarting JHipster:
ALTER TABLE DATABASECHANGELOG
ADD PRIMARY KEY (ID);
drop table jhi_persistent_audit_evt_data;
drop table jhi_persistent_audit_event;
drop table jhi_user_authority;
drop table jhi_authority;
drop table jhi_user;
That should resolve the issue.

MariaDB Error Using pymysql in AirFlow

Trying airflow with MariaDB and got the following sql error: I tried almost the same thing in my test.py and it works. Don't know how airflow handles this. Any tip? Airflow v1.7.1.3.
sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, u"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'default'', 3, 'BashOperator', NULL)' at line 1") [SQL: u'INSERT INTO task_instance (task_id, dag_id, execution_date, start_date, end_date, duration, state, try_number, hostname, unixname, job_id, pool, queue, priority_weight, operator, queued_dttm) VALUES (%(task_id)s, %(dag_id)s, %(execution_date)s, %(start_date)s, %(end_date)s, %(duration)s, %(state)s, %(try_number)s, %(hostname)s, %(unixname)s, %(job_id)s, %(pool)s, %(queue)s, %(priority_weight)s, %(operator)s, %(queued_dttm)s)'] [parameters: {'execution_date': datetime.datetime(2017, 10, 31, 0, 0), 'end_date': None, 'job_id': '43', 'task_id': 'print_date', 'pool': None, 'unixname': 'nrsapp', 'queued_dttm': None, 'try_number': 1, 'queue': 'default', 'operator': 'BashOperator', 'state': u'running', 'start_date': datetime.datetime(2017, 11, 3, 17, 53, 46, 178764), 'duration': None, 'priority_weight': 3, 'hostname': 'zlt11238', 'dag_id': 'tutorial'}]

MySQL simple query syntax error

When I try to run this simple script:
INSERT INTO landlord (full_name, tel_number, email, password) VALUES
('landlord1', '12345', 'landlord1#email.com', 'pass1'),
('landlord2', '12345', 'landlord2#email.com', 'pass2'),
('landlord3', '12345', 'landlord3#email.com', 'pass3');
I got an error:
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 'INSERT INTO landlord (full_name, tel_number, email, password) VALUES
('landlor' at line 2
What's wrong with it?