Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: 使用chatglm 通过langchain调用tidb数据库时有问题改成mysql就好了
The specific error is sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, 'You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 12 near “请求模型” ')
[SQL: 请求模型]
What are the character sets of the two databases?
Check the code for the SQL statement that caused the error, then run it in TiDB to see where it is incompatible with MySQL.
Go to the dashboard’s log search and search for the keyword “command dispatched failed”. You can find the SQL that caused the error.
The issue of syntax support
It should be a database encoding issue. There is no problem when switching to other databases. This database has not set the character set encoding.
I am using sqldatabasechain for interaction here, and it is not associated with specific SQL statements.
Boss, TiDB and Flink always show this error, but it gets better after a while. Which TiDB configuration might be the problem?
You have no problem asking about other middleware here in TiDB.
At least provide the version information of flink-cdc-connectors.
At the very least, it seems that it is no longer written this way.
Using TiDB 7.3, Flink 1.17, flink-sql-connector-tidb-cdc 2.2.1. If CDC uses a version later than 2.2.1, the CPU will always be highly utilized.
When fetching the tableId, a null pointer exception occurred.
Currently, it’s unclear which position has the null pointer.
Are there any other exceptions in the error stack?
Looking at it now, TiSession will check whether this session has been closed.
Could it be a session expiration issue?
This situation always fails directly during initialization.
Also, could it be that your table is a view?
.collect(Collectors.toList());
}
public TiTableInfo getTable(TiDBInfo db, String tableName) {
Map<String, TiTableInfo> tableMap = tableCache.get(db);
if (tableMap == null) {
tableMap = loadTables(db);
}
TiTableInfo tbl = tableMap.get(tableName.toLowerCase());
// https://github.com/pingcap/tispark/issues/961
// TODO: support reading from view table in the future.
if (tbl != null && (tbl.isView() || tbl.isSequence())) return null;
return tbl;
}
private Map<String, TiTableInfo> loadTables(TiDBInfo db) {
List<TiTableInfo> tables = transaction.getTables(db.getId());
ImmutableMap.Builder<String, TiTableInfo> builder = ImmutableMap.builder();
for (TiTableInfo table : tables) {
builder.put(table.getName().toLowerCase(), table);
}
// https://github.com/pingcap/tispark/issues/961
// TODO: support reading from view table in the future.
I see a comment here saying that views are not supported.