5 ms·
How is SQL hard for a computer to parse? SQLite can parse its flavour of SQL using a plain old LALR grammar and that covers a lot of SQL. And even if it was, h
by hobo_mark 3y ago
How is SQL hard for a computer to parse? SQLite can parse its flavour of SQL using a plain old LALR grammar and that covers a lot of SQL.
And even if it was, how does having an ORM generate the SQL behind your back change anything for the computer that still has to parse SQL?
- actuallyalys 3y agoI suspect what is really meant is that it is time consuming to write a parser that encompasses all of its syntax, not that it is performance intensive or is high on the Chomsky hierarchy.
- hobo_mark 3y agoBut, at least for SQLite, the parser is autogenerated from a plain grammar.
- tracker1 3y agoIt's not so much the parsing... it's the validation against an underlying data source. I can write `SELECT A, B from Foo` and it's "valid SQL" but that doesn't mean the underlying Foo table exists, or that the columns are there. Beyond this, that doesn't mean it understands that A should map to an Int32 or that B should be a UTF-8 byte array in the outer language I'm working with. Personally, I'm fine with the likes of type mappers like what Dapper in C# does, or serde_postgres offers in Rust. For that matter template string processors in JS/Node/Deno are also really nice. Yeah, you need to understand the underlying data source, but that's often far easier than massive amounts of boilerplate.
- paulddraper 3y agoI'm not sure about SQLite, but try looking for "PostgreSQL parser". It's far from simple.