codecop 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codecop/__init__.py +7 -0
- codecop/access.py +140 -0
- codecop/access_postgres.py +284 -0
- codecop/advisor.py +1512 -0
- codecop/advisor_bench.py +493 -0
- codecop/advisor_ch.py +2080 -0
- codecop/advisor_view.py +381 -0
- codecop/advisors.py +184 -0
- codecop/agent.py +221 -0
- codecop/agentfacts.py +745 -0
- codecop/apply/__init__.py +327 -0
- codecop/apply/check.py +344 -0
- codecop/apply/cli.py +162 -0
- codecop/apply/clickhouse.py +379 -0
- codecop/apply/common.py +238 -0
- codecop/apply/html.py +264 -0
- codecop/apply/patch.py +213 -0
- codecop/apply/postgres.py +102 -0
- codecop/apply/trial.py +166 -0
- codecop/assemble.py +104 -0
- codecop/baseline.py +1043 -0
- codecop/bench.py +2464 -0
- codecop/blockers.py +935 -0
- codecop/budget.py +980 -0
- codecop/catalog_profile.py +525 -0
- codecop/changed.py +261 -0
- codecop/cicmd.py +1002 -0
- codecop/cli.py +5421 -0
- codecop/client.py +729 -0
- codecop/coverage.py +1067 -0
- codecop/coverage_reasons.py +116 -0
- codecop/crashlog.py +70 -0
- codecop/datagen.py +766 -0
- codecop/datagen_postgres.py +630 -0
- codecop/datagen_sqlite.py +323 -0
- codecop/dbcli.py +885 -0
- codecop/definitions.py +457 -0
- codecop/discover/__init__.py +702 -0
- codecop/discover/arms.py +160 -0
- codecop/discover/base.py +234 -0
- codecop/discover/dialect.py +296 -0
- codecop/discover/elixir.py +64 -0
- codecop/discover/engine_go.py +320 -0
- codecop/discover/go.py +1947 -0
- codecop/discover/java.py +1528 -0
- codecop/discover/loops.py +1671 -0
- codecop/discover/named_go.py +258 -0
- codecop/discover/origins.py +4565 -0
- codecop/discover/origins_ts.py +1584 -0
- codecop/discover/orm_django.py +2772 -0
- codecop/discover/orm_django_models.py +814 -0
- codecop/discover/orm_django_sql.py +662 -0
- codecop/discover/orm_ent.py +565 -0
- codecop/discover/orm_ex_ecto.py +2138 -0
- codecop/discover/orm_go.py +2134 -0
- codecop/discover/orm_go_bun.py +602 -0
- codecop/discover/orm_go_run.py +636 -0
- codecop/discover/orm_go_types.py +1082 -0
- codecop/discover/orm_java.py +1450 -0
- codecop/discover/orm_jdbi.py +743 -0
- codecop/discover/orm_jooq.py +806 -0
- codecop/discover/orm_jpa.py +1307 -0
- codecop/discover/orm_mybatis.py +730 -0
- codecop/discover/orm_py.py +557 -0
- codecop/discover/orm_py_peewee.py +1266 -0
- codecop/discover/orm_py_prisma.py +298 -0
- codecop/discover/orm_rb_activerecord.py +1906 -0
- codecop/discover/orm_rust.py +1248 -0
- codecop/discover/orm_rust_seaorm.py +734 -0
- codecop/discover/orm_sqlalchemy.py +2475 -0
- codecop/discover/orm_stats.py +307 -0
- codecop/discover/orm_tables.py +29 -0
- codecop/discover/orm_ts.py +503 -0
- codecop/discover/orm_ts_drizzle.py +697 -0
- codecop/discover/orm_ts_knex.py +1117 -0
- codecop/discover/orm_ts_kysely.py +861 -0
- codecop/discover/orm_ts_prisma.py +1045 -0
- codecop/discover/orm_ts_schema.py +169 -0
- codecop/discover/orm_ts_sequelize.py +1401 -0
- codecop/discover/orm_ts_typeorm.py +1067 -0
- codecop/discover/probes.py +323 -0
- codecop/discover/python.py +595 -0
- codecop/discover/ruby.py +793 -0
- codecop/discover/rust.py +2378 -0
- codecop/discover/schema.py +520 -0
- codecop/discover/schema_ent.py +145 -0
- codecop/discover/schema_ts.py +420 -0
- codecop/discover/tsresolve.py +257 -0
- codecop/discover/typescript.py +1728 -0
- codecop/discover/xml_mapper.py +526 -0
- codecop/engines/__init__.py +515 -0
- codecop/engines/base.py +498 -0
- codecop/engines/clickhouse.py +1558 -0
- codecop/engines/pg_ddl.py +444 -0
- codecop/engines/pg_hints.py +137 -0
- codecop/engines/postgres.py +1060 -0
- codecop/engines/sqlite.py +742 -0
- codecop/families/__init__.py +3 -0
- codecop/families/build.py +280 -0
- codecop/families/cli.py +177 -0
- codecop/families/coverage_hook.py +62 -0
- codecop/families/driver.py +221 -0
- codecop/families/goslice.py +229 -0
- codecop/families/goslice_tool/go.mod +3 -0
- codecop/families/goslice_tool/main.go +403 -0
- codecop/families/holes.py +451 -0
- codecop/families/images/Dockerfile.go +5 -0
- codecop/families/images/Dockerfile.python +4 -0
- codecop/families/images/Dockerfile.rust +4 -0
- codecop/families/isolate.py +171 -0
- codecop/families/locate.py +270 -0
- codecop/families/model.py +301 -0
- codecop/families/plangate.py +271 -0
- codecop/families/tagpatch.py +174 -0
- codecop/fidelity.py +671 -0
- codecop/fixgroups.py +130 -0
- codecop/formerly.py +91 -0
- codecop/grantscript.py +254 -0
- codecop/groupbench.py +1375 -0
- codecop/groups.py +594 -0
- codecop/groups_view.py +186 -0
- codecop/heat.py +1405 -0
- codecop/heatcli.py +219 -0
- codecop/joins.py +1749 -0
- codecop/joins_view.py +127 -0
- codecop/kinds/__init__.py +507 -0
- codecop/kinds/calls/__init__.py +501 -0
- codecop/kinds/calls/extract.py +1097 -0
- codecop/kinds/calls/harness.py +408 -0
- codecop/kinds/calls/measure.py +342 -0
- codecop/kinds/calls/rules.py +139 -0
- codecop/kinds/calls/runners/RunCalls.java +167 -0
- codecop/kinds/calls/runners/run_go.go +141 -0
- codecop/kinds/calls/runners/run_node.js +186 -0
- codecop/kinds/calls/runners/run_python.py +319 -0
- codecop/kinds/calls/runners/run_rust.rs +200 -0
- codecop/kinds/calls/standin.py +340 -0
- codecop/kinds/pipeline.py +288 -0
- codecop/kinds/regex/__init__.py +1167 -0
- codecop/kinds/regex/engines/RegexHarness.java +129 -0
- codecop/kinds/regex/engines/run_go.go +294 -0
- codecop/kinds/regex/engines/run_node.js +99 -0
- codecop/kinds/regex/engines/run_python.py +295 -0
- codecop/kinds/regex/engines/run_rust.rs +149 -0
- codecop/kinds/regex/extract.py +1438 -0
- codecop/kinds/regex/harness.py +235 -0
- codecop/kinds/regex/measure.py +270 -0
- codecop/kinds/regex/shapes.py +418 -0
- codecop/kinds/regex/syntax.py +1721 -0
- codecop/kinds/testkind.py +107 -0
- codecop/kinds/transaction/__init__.py +228 -0
- codecop/kinds/transaction/bind.py +355 -0
- codecop/kinds/transaction/measure.py +264 -0
- codecop/kinds/transaction/plan.py +462 -0
- codecop/kinds/transaction/rules.py +540 -0
- codecop/kinds/transaction/sandbox.py +94 -0
- codecop/kinds/transaction/scenarios.py +520 -0
- codecop/kinds/transaction/schedule.py +483 -0
- codecop/kinds/transaction/shapes.py +418 -0
- codecop/kinds/transaction/verify.py +293 -0
- codecop/live.py +237 -0
- codecop/loopbench.py +2071 -0
- codecop/loopschema.py +591 -0
- codecop/mcpserver.py +120 -0
- codecop/mechanism.py +214 -0
- codecop/members.py +200 -0
- codecop/multi.py +443 -0
- codecop/observed.py +1868 -0
- codecop/parts.py +102 -0
- codecop/patterns.py +830 -0
- codecop/patterns_view.py +559 -0
- codecop/plangate.py +242 -0
- codecop/profile.py +439 -0
- codecop/prompts/areas.md +19 -0
- codecop/prompts/observed_variants.md +20 -0
- codecop/prompts/profile.md +60 -0
- codecop/prompts/profile_postgres.md +68 -0
- codecop/prompts/profile_sizes.md +26 -0
- codecop/prompts/profile_sqlite.md +69 -0
- codecop/prompts/rank.md +84 -0
- codecop/prompts/rank_postgres.md +96 -0
- codecop/prompts/rank_sqlite.md +94 -0
- codecop/prompts/scenario_variants.md +20 -0
- codecop/rank.py +1473 -0
- codecop/realdb/__init__.py +688 -0
- codecop/realdb/clickhouse.py +1223 -0
- codecop/realdb/facts.py +815 -0
- codecop/realdb/locality.py +964 -0
- codecop/realdb/locks.py +355 -0
- codecop/realdb/match.py +531 -0
- codecop/realdb/postgres.py +643 -0
- codecop/realdb/ratios.py +77 -0
- codecop/realdb/sample.py +126 -0
- codecop/relations.py +227 -0
- codecop/report.py +1854 -0
- codecop/resources.py +332 -0
- codecop/resources_view.py +266 -0
- codecop/rules/entry_points.toml +1013 -0
- codecop/rules/sinks.toml +362 -0
- codecop/runsonce.py +8 -0
- codecop/sandboxschema.py +555 -0
- codecop/scenario_agent.py +172 -0
- codecop/scenario_bind.py +507 -0
- codecop/scenario_sql.py +971 -0
- codecop/scenarios.py +675 -0
- codecop/scenarios_view.py +274 -0
- codecop/schemacli.py +67 -0
- codecop/schemas/areas_output.schema.json +21 -0
- codecop/schemas/profile_output.schema.json +362 -0
- codecop/schemas/rank_output.schema.json +385 -0
- codecop/sizes.py +200 -0
- codecop/sqlinfo.py +558 -0
- codecop/typedparams.py +576 -0
- codecop/verdicts.py +212 -0
- codecop/writebench.py +720 -0
- codecop/writecost.py +440 -0
- codecop/writes.py +1208 -0
- codecop-0.1.0.dist-info/METADATA +42 -0
- codecop-0.1.0.dist-info/RECORD +222 -0
- codecop-0.1.0.dist-info/WHEEL +4 -0
- codecop-0.1.0.dist-info/entry_points.txt +2 -0
- codecop-0.1.0.dist-info/licenses/LICENSE +21 -0
codecop/rules/sinks.toml
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
# Where SQL enters a database driver, per language.
|
|
2
|
+
# This file is data: the Python and (later) Rust implementations load it unchanged.
|
|
3
|
+
#
|
|
4
|
+
# sink: a method or function name whose argument is SQL.
|
|
5
|
+
# names callee names (the last segment: `client.query(...)` matches "query")
|
|
6
|
+
# engine the engine this sink implies, or "" when the SQL text and imports decide
|
|
7
|
+
# args positional indexes that may hold the SQL
|
|
8
|
+
# kwargs keyword names that may hold the SQL
|
|
9
|
+
# imports: module or crate prefix -> engine, used as a per-file hint.
|
|
10
|
+
|
|
11
|
+
[python]
|
|
12
|
+
[[python.sink]]
|
|
13
|
+
names = ["query", "query_df", "query_np", "query_arrow", "query_df_stream", "query_rows_stream",
|
|
14
|
+
"query_row_block_stream", "query_column_block_stream", "raw_query", "raw_stream", "command"]
|
|
15
|
+
engine = "clickhouse"
|
|
16
|
+
args = [0]
|
|
17
|
+
kwargs = ["query", "cmd"]
|
|
18
|
+
|
|
19
|
+
[[python.sink]]
|
|
20
|
+
names = ["execute", "executemany", "executescript", "execute_iter", "fetch", "fetchrow", "fetchval",
|
|
21
|
+
"execute_fetchall", "text", "execute_sql"]
|
|
22
|
+
engine = ""
|
|
23
|
+
args = [0]
|
|
24
|
+
kwargs = ["query", "sql", "statement", "operation"]
|
|
25
|
+
|
|
26
|
+
[python.imports]
|
|
27
|
+
clickhouse_connect = "clickhouse"
|
|
28
|
+
clickhouse_driver = "clickhouse"
|
|
29
|
+
chdb = "clickhouse"
|
|
30
|
+
sqlite3 = "sqlite"
|
|
31
|
+
aiosqlite = "sqlite"
|
|
32
|
+
psycopg = "postgres"
|
|
33
|
+
psycopg2 = "postgres"
|
|
34
|
+
psycopg_pool = "postgres"
|
|
35
|
+
asyncpg = "postgres"
|
|
36
|
+
|
|
37
|
+
[rust]
|
|
38
|
+
# Rust names: a bare name is a method call (`client.query(sql)`). A name with `::` is a
|
|
39
|
+
# path call matched on its trailing segments, turbofish ignored (`sqlx::query_as::<_, Row>(sql)`,
|
|
40
|
+
# `QueryBuilder::<Postgres>::new(sql)`), after the first segment is expanded through the
|
|
41
|
+
# file's `use` lines (`use sqlx::query; query(sql)`). Text pushed onto a QueryBuilder is appended.
|
|
42
|
+
# Functions that pass a parameter to a sink (for example a client wrapper with its own
|
|
43
|
+
# `query` / `query_redacted`) are found automatically and need no entry here.
|
|
44
|
+
[[rust.sink]]
|
|
45
|
+
names = ["query"]
|
|
46
|
+
engine = "clickhouse"
|
|
47
|
+
args = [0]
|
|
48
|
+
kwargs = []
|
|
49
|
+
|
|
50
|
+
[[rust.sink]]
|
|
51
|
+
names = ["sqlx::query", "sqlx::query_as", "sqlx::query_scalar", "sqlx::query_with", "sqlx::query_as_with",
|
|
52
|
+
"sqlx::query_scalar_with", "sqlx::raw_sql", "sqlx::QueryBuilder::new", "QueryBuilder::new"]
|
|
53
|
+
engine = "postgres"
|
|
54
|
+
args = [0]
|
|
55
|
+
kwargs = []
|
|
56
|
+
|
|
57
|
+
# tokio_postgres, rusqlite, sqlx Executor and similar: the SQL text and the file's crates decide the engine.
|
|
58
|
+
[[rust.sink]]
|
|
59
|
+
names = ["execute", "execute_batch", "batch_execute", "simple_query", "query_one", "query_opt", "query_row",
|
|
60
|
+
"query_raw", "query_map", "prepare", "prepare_cached", "fetch_all", "fetch_one", "fetch_optional"]
|
|
61
|
+
engine = ""
|
|
62
|
+
args = [0]
|
|
63
|
+
kwargs = []
|
|
64
|
+
|
|
65
|
+
[rust.imports]
|
|
66
|
+
clickhouse = "clickhouse"
|
|
67
|
+
sqlx = "postgres"
|
|
68
|
+
tokio_postgres = "postgres"
|
|
69
|
+
postgres = "postgres"
|
|
70
|
+
deadpool_postgres = "postgres"
|
|
71
|
+
rusqlite = "sqlite"
|
|
72
|
+
|
|
73
|
+
[java]
|
|
74
|
+
# Java names: a bare name is a method call matched on the method name alone
|
|
75
|
+
# (`jdbcTemplate.queryForList(sql, ...)` matches "queryForList").
|
|
76
|
+
# A name that starts with "@" is an annotation whose element holds the query:
|
|
77
|
+
# args = [0] the single unnamed element, `@Query("...")`
|
|
78
|
+
# kwargs named elements that hold a query, `@Query(value = "...", countQuery = "...")`;
|
|
79
|
+
# each one present becomes its own site. A `{"...", "..."}` array is joined with spaces.
|
|
80
|
+
# engine = "jpql" marks JPQL/HQL, which is not SQL: later stages must treat it separately.
|
|
81
|
+
# A "jpql" annotation with `nativeQuery = true` is plain SQL, and the engine falls back to the imports.
|
|
82
|
+
# Query text that is Cypher is reported with engine "cypher" whatever the sink says.
|
|
83
|
+
# Methods that pass a parameter to a sink are found automatically and need no entry here.
|
|
84
|
+
|
|
85
|
+
# JDBC, Spring JdbcTemplate / NamedParameterJdbcTemplate, jOOQ plain SQL, clickhouse-java client,
|
|
86
|
+
# Hibernate native SQL: the SQL text and the file's imports decide the engine.
|
|
87
|
+
[[java.sink]]
|
|
88
|
+
names = ["executeQuery", "executeUpdate", "executeLargeUpdate", "execute", "prepareStatement", "prepareCall",
|
|
89
|
+
"addBatch", "nativeSQL", "createStatement",
|
|
90
|
+
"query", "queryForObject", "queryForList", "queryForMap", "queryForRowSet", "queryForStream",
|
|
91
|
+
"update", "batchUpdate",
|
|
92
|
+
"createNativeQuery", "createSQLQuery", "createNativeMutationQuery",
|
|
93
|
+
"fetch", "fetchOne", "fetchMany", "resultQuery"]
|
|
94
|
+
engine = ""
|
|
95
|
+
args = [0]
|
|
96
|
+
kwargs = []
|
|
97
|
+
|
|
98
|
+
# JPA / Hibernate query language. `createNamedQuery("name")` is resolved through @NamedQuery.
|
|
99
|
+
[[java.sink]]
|
|
100
|
+
names = ["createQuery", "createNamedQuery", "createSelectionQuery", "createMutationQuery"]
|
|
101
|
+
engine = "jpql"
|
|
102
|
+
args = [0]
|
|
103
|
+
kwargs = []
|
|
104
|
+
|
|
105
|
+
# Spring Data: JPQL unless nativeQuery = true.
|
|
106
|
+
[[java.sink]]
|
|
107
|
+
names = ["@Query", "@NamedQuery"]
|
|
108
|
+
engine = "jpql"
|
|
109
|
+
args = [0]
|
|
110
|
+
kwargs = ["value", "query", "countQuery"]
|
|
111
|
+
|
|
112
|
+
# Annotations that always carry SQL: JPA native queries, MyBatis mappers, Spring test @Sql statements.
|
|
113
|
+
[[java.sink]]
|
|
114
|
+
names = ["@NamedNativeQuery", "@Select", "@Insert", "@Update", "@Delete", "@Sql"]
|
|
115
|
+
engine = ""
|
|
116
|
+
args = [0]
|
|
117
|
+
kwargs = ["value", "query", "statements"]
|
|
118
|
+
|
|
119
|
+
# Package prefix -> engine. "" marks a database API that does not name an engine: the SQL text
|
|
120
|
+
# decides, and the entry only tells the extractor that the file talks to a database.
|
|
121
|
+
[java.imports]
|
|
122
|
+
"com.clickhouse" = "clickhouse"
|
|
123
|
+
"ru.yandex.clickhouse" = "clickhouse"
|
|
124
|
+
"org.postgresql" = "postgres"
|
|
125
|
+
"org.sqlite" = "sqlite"
|
|
126
|
+
"org.neo4j" = "cypher"
|
|
127
|
+
"java.sql" = ""
|
|
128
|
+
"javax.sql" = ""
|
|
129
|
+
"org.springframework.jdbc" = ""
|
|
130
|
+
"org.springframework.data.jpa" = ""
|
|
131
|
+
"org.springframework.data.repository" = ""
|
|
132
|
+
"jakarta.persistence" = ""
|
|
133
|
+
"javax.persistence" = ""
|
|
134
|
+
"org.hibernate" = ""
|
|
135
|
+
"org.jooq" = ""
|
|
136
|
+
"org.apache.ibatis" = ""
|
|
137
|
+
|
|
138
|
+
[go]
|
|
139
|
+
# Go names: the last segment of the callee (`s.pool.QueryRow(...)` matches "QueryRow"; a generic
|
|
140
|
+
# instantiation such as `clickhouse.Query[Row](...)` matches "Query"). Most drivers take a
|
|
141
|
+
# context.Context first, so `args` indexes are counted after a leading context argument when the
|
|
142
|
+
# call has one: `db.Query(sql)` and `pool.Query(ctx, sql)` are both index 0. When several indexes
|
|
143
|
+
# are listed the first one that resolves to SQL wins.
|
|
144
|
+
# Go has no keyword arguments; `kwargs` carries rule options instead:
|
|
145
|
+
# "weak" the name is common outside database code (Get, Select, Run): the argument must
|
|
146
|
+
# resolve to a full statement, or be named like SQL, to count
|
|
147
|
+
# "passthrough" not a call site, but a function that hands its own sql/query parameter to this
|
|
148
|
+
# is a wrapper (hand-written HTTP clients post the SQL as the request body)
|
|
149
|
+
# Functions that pass a parameter to a sink are found automatically and need no entry here.
|
|
150
|
+
|
|
151
|
+
# database/sql, pgx (and batch.Queue), sqlx, clickhouse-go, bun: the SQL text and the file's imports decide the engine.
|
|
152
|
+
[[go.sink]]
|
|
153
|
+
names = ["Query", "QueryRow", "Exec", "QueryContext", "QueryRowContext", "ExecContext", "PrepareContext",
|
|
154
|
+
"NamedExec", "NamedQuery", "NamedExecContext", "NamedQueryContext", "Queryx", "QueryRowx", "QueryxContext",
|
|
155
|
+
"QueryRowxContext", "MustExec", "MustExecContext", "PrepareNamed", "PrepareNamedContext", "Preparex",
|
|
156
|
+
"PreparexContext", "NewRaw", "Queue"]
|
|
157
|
+
engine = ""
|
|
158
|
+
args = [0]
|
|
159
|
+
kwargs = []
|
|
160
|
+
|
|
161
|
+
# database/sql Prepare(sql), pgx Prepare(ctx, name, sql).
|
|
162
|
+
[[go.sink]]
|
|
163
|
+
names = ["Prepare"]
|
|
164
|
+
engine = ""
|
|
165
|
+
args = [0, 1]
|
|
166
|
+
kwargs = []
|
|
167
|
+
|
|
168
|
+
[[go.sink]]
|
|
169
|
+
names = ["PrepareBatch", "AsyncInsert"]
|
|
170
|
+
engine = "clickhouse"
|
|
171
|
+
args = [0]
|
|
172
|
+
kwargs = []
|
|
173
|
+
|
|
174
|
+
# sqlx Get/Select(dest, sql), clickhouse-go Select(ctx, dest, sql).
|
|
175
|
+
[[go.sink]]
|
|
176
|
+
names = ["Get", "Select", "GetContext", "SelectContext"]
|
|
177
|
+
engine = ""
|
|
178
|
+
args = [1]
|
|
179
|
+
kwargs = ["weak"]
|
|
180
|
+
|
|
181
|
+
# GORM db.Raw(sql, values...).
|
|
182
|
+
[[go.sink]]
|
|
183
|
+
names = ["Raw"]
|
|
184
|
+
engine = ""
|
|
185
|
+
args = [0]
|
|
186
|
+
kwargs = ["weak"]
|
|
187
|
+
|
|
188
|
+
# neo4j: session.Run / tx.Run(ctx, cypher, params), neo4j.ExecuteQuery(ctx, driver, cypher, ...).
|
|
189
|
+
# Only applied in packages that import the neo4j driver.
|
|
190
|
+
[[go.sink]]
|
|
191
|
+
names = ["Run", "ExecuteQuery"]
|
|
192
|
+
engine = "cypher"
|
|
193
|
+
args = [0, 1]
|
|
194
|
+
kwargs = ["weak"]
|
|
195
|
+
|
|
196
|
+
[[go.sink]]
|
|
197
|
+
names = ["NewReader", "NewBufferString"]
|
|
198
|
+
engine = ""
|
|
199
|
+
args = [0]
|
|
200
|
+
kwargs = ["passthrough"]
|
|
201
|
+
|
|
202
|
+
# Import-path prefix -> engine. "" marks a database API that does not name an engine: the SQL text
|
|
203
|
+
# decides, and the entry only tells the extractor that the package talks to a database.
|
|
204
|
+
[go.imports]
|
|
205
|
+
"github.com/ClickHouse/clickhouse-go" = "clickhouse"
|
|
206
|
+
"github.com/ClickHouse/ch-go" = "clickhouse"
|
|
207
|
+
"github.com/jackc/pgx" = "postgres"
|
|
208
|
+
"github.com/jackc/pgconn" = "postgres"
|
|
209
|
+
"github.com/lib/pq" = "postgres"
|
|
210
|
+
"github.com/uptrace/bun/driver/pgdriver" = "postgres"
|
|
211
|
+
"gorm.io/driver/postgres" = "postgres"
|
|
212
|
+
"gorm.io/driver/clickhouse" = "clickhouse"
|
|
213
|
+
"gorm.io/driver/sqlite" = "sqlite"
|
|
214
|
+
"github.com/mattn/go-sqlite3" = "sqlite"
|
|
215
|
+
"modernc.org/sqlite" = "sqlite"
|
|
216
|
+
"github.com/neo4j/neo4j-go-driver" = "cypher"
|
|
217
|
+
"database/sql" = ""
|
|
218
|
+
"github.com/jmoiron/sqlx" = ""
|
|
219
|
+
"gorm.io/gorm" = ""
|
|
220
|
+
"github.com/uptrace/bun" = ""
|
|
221
|
+
|
|
222
|
+
[typescript]
|
|
223
|
+
# TypeScript and JavaScript (.ts .tsx .js .jsx .mjs .cjs). Names: the last segment of the callee
|
|
224
|
+
# (`this.pool.query(...)` matches "query"). A name that starts with a backtick is a template tag:
|
|
225
|
+
# "`sql" matches sql`...`, Prisma.sql`...`, sql<Row>`...` and sql.type(Row)`...`.
|
|
226
|
+
# `args` are positional indexes. `kwargs` holds the keys of an options object that carry the SQL
|
|
227
|
+
# (`client.query({ text })`, `client.query({ query, query_params })`) and rule options:
|
|
228
|
+
# "weak" the name is common outside database code (run, get, all, raw): only a resolved
|
|
229
|
+
# statement counts, never an unresolved argument
|
|
230
|
+
# "insert-table" `client.insert({ table, values })` of @clickhouse/client: reported as
|
|
231
|
+
# INSERT INTO <table> FORMAT JSONEachRow, which is the statement the client sends
|
|
232
|
+
# engine = "prisma" means the engine of the nearest schema.prisma datasource.
|
|
233
|
+
# Functions that pass a parameter (or a property of an options parameter) to a sink are found
|
|
234
|
+
# automatically and need no entry here.
|
|
235
|
+
|
|
236
|
+
# pg, mysql2, TypeORM DataSource / EntityManager / QueryRunner, Sequelize raw, @clickhouse/client,
|
|
237
|
+
# Drizzle `db.execute(sql`...`)`, Bun and Deno drivers: the SQL text and the file's imports decide the engine.
|
|
238
|
+
[[typescript.sink]]
|
|
239
|
+
names = ["query", "execute", "queryRaw", "executeRaw", "executeSql", "queryObject", "queryArray", "executeQuery",
|
|
240
|
+
"rawQuery", "runQuery", "runSql", "sqlQuery", "multi"]
|
|
241
|
+
engine = ""
|
|
242
|
+
args = [0]
|
|
243
|
+
kwargs = ["query", "text", "sql"]
|
|
244
|
+
|
|
245
|
+
# @clickhouse/client: client.command({ query }), client.exec({ query })
|
|
246
|
+
[[typescript.sink]]
|
|
247
|
+
names = ["command"]
|
|
248
|
+
engine = "clickhouse"
|
|
249
|
+
args = [0]
|
|
250
|
+
kwargs = ["query", "weak"]
|
|
251
|
+
|
|
252
|
+
[[typescript.sink]]
|
|
253
|
+
names = ["insert"]
|
|
254
|
+
engine = "clickhouse"
|
|
255
|
+
args = [0]
|
|
256
|
+
kwargs = ["insert-table"]
|
|
257
|
+
|
|
258
|
+
# Prisma raw queries called as functions: prisma.$queryRawUnsafe("..."), prisma.$queryRaw(Prisma.sql`...`)
|
|
259
|
+
[[typescript.sink]]
|
|
260
|
+
names = ["$queryRawUnsafe", "$executeRawUnsafe", "$queryRaw", "$executeRaw"]
|
|
261
|
+
engine = "prisma"
|
|
262
|
+
args = [0]
|
|
263
|
+
kwargs = []
|
|
264
|
+
|
|
265
|
+
# better-sqlite3 prepare / exec, sqlite3 all / get / run / each, knex.raw, postgres.js sql.unsafe,
|
|
266
|
+
# slonik pool.any / one / many, Kysely CompiledQuery.raw
|
|
267
|
+
[[typescript.sink]]
|
|
268
|
+
names = ["exec", "run", "all", "get", "each", "prepare", "raw", "unsafe", "any", "one", "many", "maybeOne", "oneFirst",
|
|
269
|
+
"manyFirst", "anyFirst", "maybeOneFirst", "batch", "none", "oneOrNone", "manyOrNone", "result", "pragma"]
|
|
270
|
+
engine = ""
|
|
271
|
+
args = [0]
|
|
272
|
+
kwargs = ["query", "text", "sql", "weak"]
|
|
273
|
+
|
|
274
|
+
# Template tags.
|
|
275
|
+
[[typescript.sink]]
|
|
276
|
+
names = ["`sql", "`SQL", "`sqlFragment", "`unsafe", "`fragment", "`pgSql", "`psql", "`pg", "`tx", "`trx", "`query"]
|
|
277
|
+
engine = ""
|
|
278
|
+
args = [0]
|
|
279
|
+
kwargs = []
|
|
280
|
+
|
|
281
|
+
[[typescript.sink]]
|
|
282
|
+
names = ["`$queryRaw", "`$executeRaw"]
|
|
283
|
+
engine = "prisma"
|
|
284
|
+
args = [0]
|
|
285
|
+
kwargs = []
|
|
286
|
+
|
|
287
|
+
# Module specifier (or a prefix of it up to a "/") -> engine. "" marks a database API that does not
|
|
288
|
+
# name an engine: the SQL text decides, and the entry only says that the file talks to a database.
|
|
289
|
+
[typescript.imports]
|
|
290
|
+
"pg" = "postgres"
|
|
291
|
+
"pg-pool" = "postgres"
|
|
292
|
+
"pg-promise" = "postgres"
|
|
293
|
+
"pg-cursor" = "postgres"
|
|
294
|
+
"pg-query-stream" = "postgres"
|
|
295
|
+
"postgres" = "postgres"
|
|
296
|
+
"slonik" = "postgres"
|
|
297
|
+
"@vercel/postgres" = "postgres"
|
|
298
|
+
"@neondatabase/serverless" = "postgres"
|
|
299
|
+
"@electric-sql/pglite" = "postgres"
|
|
300
|
+
"@clickhouse/client" = "clickhouse"
|
|
301
|
+
"@clickhouse/client-web" = "clickhouse"
|
|
302
|
+
"@clickhouse/client-common" = "clickhouse"
|
|
303
|
+
"clickhouse" = "clickhouse"
|
|
304
|
+
"mysql" = "mysql"
|
|
305
|
+
"mysql2" = "mysql"
|
|
306
|
+
"@planetscale/database" = "mysql"
|
|
307
|
+
"better-sqlite3" = "sqlite"
|
|
308
|
+
"sqlite3" = "sqlite"
|
|
309
|
+
"sqlite" = "sqlite"
|
|
310
|
+
"bun:sqlite" = "sqlite"
|
|
311
|
+
"node:sqlite" = "sqlite"
|
|
312
|
+
"@libsql/client" = "sqlite"
|
|
313
|
+
"drizzle-orm/pg-core" = "postgres"
|
|
314
|
+
"drizzle-orm/node-postgres" = "postgres"
|
|
315
|
+
"drizzle-orm/postgres-js" = "postgres"
|
|
316
|
+
"drizzle-orm/neon-http" = "postgres"
|
|
317
|
+
"drizzle-orm/neon-serverless" = "postgres"
|
|
318
|
+
"drizzle-orm/vercel-postgres" = "postgres"
|
|
319
|
+
"drizzle-orm/mysql-core" = "mysql"
|
|
320
|
+
"drizzle-orm/mysql2" = "mysql"
|
|
321
|
+
"drizzle-orm/planetscale-serverless" = "mysql"
|
|
322
|
+
"drizzle-orm/sqlite-core" = "sqlite"
|
|
323
|
+
"drizzle-orm/better-sqlite3" = "sqlite"
|
|
324
|
+
"drizzle-orm/libsql" = "sqlite"
|
|
325
|
+
"drizzle-orm/d1" = "sqlite"
|
|
326
|
+
"drizzle-orm" = ""
|
|
327
|
+
"kysely" = ""
|
|
328
|
+
"knex" = ""
|
|
329
|
+
"typeorm" = ""
|
|
330
|
+
"@nestjs/typeorm" = ""
|
|
331
|
+
"sequelize" = ""
|
|
332
|
+
"sequelize-typescript" = ""
|
|
333
|
+
"@mikro-orm/core" = ""
|
|
334
|
+
"@prisma/client" = "prisma"
|
|
335
|
+
"sql-template-strings" = ""
|
|
336
|
+
# Query languages that are not SQL: the site is kept and labelled, like Cypher and JPQL elsewhere.
|
|
337
|
+
"jsforce" = "soql"
|
|
338
|
+
"@jsforce/jsforce-node" = "soql"
|
|
339
|
+
"neo4j-driver" = "cypher"
|
|
340
|
+
"sql-template-tag" = ""
|
|
341
|
+
|
|
342
|
+
# ---- JVM ORMs and builders (appended; see discover/orm_jdbi.py) ----
|
|
343
|
+
# JDBI SQL objects: the annotation holds the SQL (a template name instead is linked to its .sql.stg template).
|
|
344
|
+
[[java.sink]]
|
|
345
|
+
names = ["@SqlQuery", "@SqlUpdate", "@SqlBatch", "@SqlCall", "@SqlScript"]
|
|
346
|
+
engine = ""
|
|
347
|
+
args = [0]
|
|
348
|
+
kwargs = ["value"]
|
|
349
|
+
|
|
350
|
+
# JDBI fluent API: Handle.createUpdate / createCall / createScript / prepareBatch take SQL.
|
|
351
|
+
[[java.sink]]
|
|
352
|
+
names = ["createUpdate", "createCall", "createScript", "prepareBatch"]
|
|
353
|
+
engine = ""
|
|
354
|
+
args = [0]
|
|
355
|
+
kwargs = []
|
|
356
|
+
|
|
357
|
+
# ---- Diesel raw SQL (appended; the query DSL is read by discover/orm_rust.py) ----
|
|
358
|
+
[[rust.sink]]
|
|
359
|
+
names = ["diesel::sql_query", "diesel::dsl::sql_query", "diesel_async::sql_query"]
|
|
360
|
+
engine = ""
|
|
361
|
+
args = [0]
|
|
362
|
+
kwargs = []
|
codecop/runsonce.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Code that runs once per deployment or by hand, told by its path."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
# code that runs once per deployment or by hand: schema and data migrations, seeds, backfills. Its statements are
|
|
6
|
+
# "nothing to gain: runs once" (never asked about, never given an index); the path decides over an area's verdict
|
|
7
|
+
RUNS_ONCE_PATH = re.compile(r"(^|/)(migrations?|migrate|db/migrate|seeds?|seeders?|seeding|backfills?|data[-_]migrations?)/|"
|
|
8
|
+
r"(^|/)[^/]*(?:backfill|seed|[-_.]migration)[^/]*\.\w+$", re.I)
|