drift icon indicating copy to clipboard operation
drift copied to clipboard

[SQLParser] Add schema-name functionnality

Open MobiliteDev opened this issue 4 years ago • 3 comments

SQLite can have a schema-name before some SQL command like SELECT or CREATE TABLE image

This is the database alias used when you ATTACH a database.

Do you think SQLParser could be able to manage this property ?

MobiliteDev avatar Jul 21 '21 07:07 MobiliteDev

I think this should be possible, but it's a large effort. For what exactly do you need this? Are you using sqlparser directly to analyze queries? Do you need this feature in moor files?

simolus3 avatar Jul 21 '21 10:07 simolus3

We work on multiple databases on a single database connection. So we always prefix our queries with schema-name (even if only one database is connected: with schema-name "main." prefix).

We do not not need this feature in moor files, only for direct analyse.

MobiliteDev avatar Jul 21 '21 12:07 MobiliteDev

I've added support for this to the parser, the AST classes and the node-to-text formatter in aa75cbaa198e5e19f2e54dbcc0033aab47ba634a. I'll still have to work on proper analysis.

simolus3 avatar Jul 22 '21 19:07 simolus3