delph-in / pydelphin

Python libraries for DELPH-IN
https://pydelphin.readthedocs.io/
MIT License
79 stars 27 forks source link

Are left joins in TSQL possible? #321

Closed arademaker closed 3 years ago

arademaker commented 3 years ago

https://pydelphin.readthedocs.io/en/latest/api/delphin.tsql.html#module-delphin.tsql

for row in tsql.select('i-id i-input mrs', ts):
  ...

I would like to have in the loop all items regardless if they have an MRS or not in the result table. Is it possible? It would be like a left/right join...

goodmami commented 3 years ago

No, because TSQL (see the TsqlRfc wiki) only allows implicit joins there's no place in the syntax to specify a left/right/inner join.

To be accurate, TSQL in PyDelphin does not mind an empty/null value for a column, but it would filter out results in a query like i-id i-input mrs when there are no rows in the result table that match the corresponding i-id (through a parse-id in the parse table).

If you want to get a result for every i-id, I suggest doing two queries: first just the i-id i-input, then later pair them up with mrs where i-id = ....

arademaker commented 3 years ago

thank you for answer. I believe we can close the issue. I proposed a link in the documentation to the query language specification that I didn't know about. Also, I added a feature request in the wiki for allowing left/right joins.