Parallelization Reference
sqldeps.parallel
Parallel processing utilities for SQL dependency extraction.
This module provides functions for extracting SQL dependencies in parallel using multiple worker processes, with shared rate limiting.
process_files_in_parallel(sql_files, framework='groq', model=None, prompt_path=None, n_workers=1, rpm=100, use_cache=True)
Extract SQL dependencies from SQL files in parallel with rate limiting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sql_files
|
list[Path]
|
List of Paths to SQL files to process |
required |
framework
|
str
|
LLM framework to use (e.g., groq, openai, deepseek) |
'groq'
|
model
|
str | None
|
Model name within the selected framework |
None
|
prompt_path
|
Path | None
|
Path to custom prompt YAML file |
None
|
n_workers
|
int
|
Number of worker processes to use (-1 for all) |
1
|
rpm
|
int
|
Requests per minute limit across all workers |
100
|
use_cache
|
bool
|
Whether to use cached results |
True
|
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary mapping file paths to SQLProfile objects |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no SQL files provided or no dependencies extracted |
Source code in sqldeps/parallel.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
resolve_workers(n_workers)
Resolve the number of worker processes to use.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_workers
|
int
|
Requested number of workers (-1 for all, >0 for specific count) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Actual number of worker processes to use |
Raises:
| Type | Description |
|---|---|
ValueError
|
If n_workers is invalid (not -1, or not between 1 and cpu_count) |