xmidt-org / codex-db

The database helper functions.
Apache License 2.0
0 stars 6 forks source link

Fix column filter error #8

Closed kcajmagic closed 4 years ago

kcajmagic commented 4 years ago

The table is defined in the README.md. type is not a column in the database. In fact it is a keyword for cassandra. (It is not reserved, which is why we didn't see the problem) This need to be fixed here: https://github.com/xmidt-org/codex-db/blob/dbee34f0e67db6d62310ba5f0d08b7586537c98c/cassandra/db.go#L160 suggestion:

 deviceInfo, err := c.finder.findRecords(limit, "WHERE device_id = ? AND record_type = ?", deviceID, eventType) 

If anywhere else the type column should be changed to record_type.

iDevoid commented 4 years ago

Hi @kcajmagic I am first timer to code on open-source, can i try to do this? I also found another line that has type = ?. is this related?

https://github.com/xmidt-org/codex-db/blob/dbee34f0e67db6d62310ba5f0d08b7586537c98c/postgresql/db.go#L271

kcajmagic commented 4 years ago

@iDevoid this is a perfect issue for new timers.

Yes it is related as type is also a keyword for Postgres. There will probably be more spots in that folder.

iDevoid commented 4 years ago

Hi @kcajmagic would you mind to take a look to my PR #10 ? please tell me your opinion and advice. Thank you :pray:

kcajmagic commented 4 years ago

Fixed in PR #10