mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
Python: Rewrite ClickHouse SQL lib modeling
This did turn into a few changes, that maybe could have been split into
separate PRs 🤷
* Rename `ClickHouseDriver` => `ClickhouseDriver`, to better follow
import name in `.qll` name
* Rewrote modeling to use API graphs
* Split modeling of `aioch` into separate `.qll` file, which does re-use
the `getExecuteMethodName` predicate. I feel that sharing code between
the modeling like this was the best approach, and stuck the
`INTERNAL: Do not use.` labels on both modules.
* I also added handling of keyword arguments (see change in .py files)
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
import python
|
||||
import experimental.meta.ConceptsTest
|
||||
import experimental.semmle.python.frameworks.ClickHouseDriver
|
||||
import experimental.semmle.python.frameworks.Aioch
|
||||
|
||||
@@ -8,13 +8,13 @@ async def aioch_test():
|
||||
client = aioch.Client("localhost")
|
||||
|
||||
await client.execute(SQL) # $ getSql=SQL
|
||||
await client.execute(query=SQL) # $ MISSING: getSql=SQL
|
||||
await client.execute(query=SQL) # $ getSql=SQL
|
||||
|
||||
await client.execute_with_progress(SQL) # $ getSql=SQL
|
||||
await client.execute_with_progress(query=SQL) # $ MISSING: getSql=SQL
|
||||
await client.execute_with_progress(query=SQL) # $ getSql=SQL
|
||||
|
||||
await client.execute_iter(SQL) # $ getSql=SQL
|
||||
await client.execute_iter(query=SQL) # $ MISSING: getSql=SQL
|
||||
await client.execute_iter(query=SQL) # $ getSql=SQL
|
||||
|
||||
|
||||
# Using custom client (this has been seen done for the blocking version in
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import python
|
||||
import experimental.meta.ConceptsTest
|
||||
import experimental.semmle.python.frameworks.ClickHouseDriver
|
||||
import experimental.semmle.python.frameworks.ClickhouseDriver
|
||||
|
||||
@@ -7,14 +7,14 @@ SQL = "SOME SQL"
|
||||
# Normal operation
|
||||
client = clickhouse_driver.client.Client("localhost")
|
||||
|
||||
client.execute(SQL) # $ MISSING: getSql=SQL
|
||||
client.execute(query=SQL) # $ MISSING: getSql=SQL
|
||||
client.execute(SQL) # $ getSql=SQL
|
||||
client.execute(query=SQL) # $ getSql=SQL
|
||||
|
||||
client.execute_with_progress(SQL) # $ MISSING: getSql=SQL
|
||||
client.execute_with_progress(query=SQL) # $ MISSING: getSql=SQL
|
||||
client.execute_with_progress(SQL) # $ getSql=SQL
|
||||
client.execute_with_progress(query=SQL) # $ getSql=SQL
|
||||
|
||||
client.execute_iter(SQL) # $ MISSING: getSql=SQL
|
||||
client.execute_iter(query=SQL) # $ MISSING: getSql=SQL
|
||||
client.execute_iter(SQL) # $ getSql=SQL
|
||||
client.execute_iter(query=SQL) # $ getSql=SQL
|
||||
|
||||
|
||||
# commonly used alias
|
||||
|
||||
Reference in New Issue
Block a user