Skip to content
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

parse create mysql string error #20

Closed
exitNA opened this issue Sep 12, 2021 · 2 comments
Closed

parse create mysql string error #20

exitNA opened this issue Sep 12, 2021 · 2 comments

Comments

@exitNA
Copy link

exitNA commented Sep 12, 2021

raw = '''
CREATE TABLE `t_customer_account` (
  `id` int,
  `customer_id` int,
  `bank` varchar(100),
  `account_no` varchar(100)
);
'''
parsed = sqlglot.parse(raw, sqlglot.dialects.MySQL)

I got error:

ParseError: Expected ). Line 2, Col: 7.

CREATE TABLE `t_customer_account` (
  `id` int,
  `customer_id` int,
  `bank` varchar(100),
  `a

sqlglot version: v1.3.2

@tobymao
Copy link
Owner

tobymao commented Sep 12, 2021

working on a solution, should have something by tonight, i need to also handle complex types like map<> and struct

@exitNA
Copy link
Author

exitNA commented Sep 13, 2021

working on a solution, should have something by tonight, i need to also handle complex types like map<> and struct

it has been solved, but, another sql failed:

CREATE TABLE `t_customer_account` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `customer_id` int(11) DEFAULT NULL COMMENT '客户id',
  `bank` varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT '行别',
  `account_no` varchar(100) COLLATE utf8_bin DEFAULT NULL COMMENT '账号',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='客户账户表';

hechao-ustc pushed a commit to hechao-ustc/sqlglot that referenced this issue Aug 23, 2024
…mao#20)

[feat](clickhouse,doris) add
sha244、toInt64OrDefault、toInt8OrDefault、timeStampAdd and timeStampSub
function convertor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants