Skip to content

Instantly share code, notes, and snippets.

@fededri
Last active March 20, 2024 21:20
Show Gist options
  • Save fededri/e5129d293ca6fdddc680194c1d9d75fe to your computer and use it in GitHub Desktop.
Save fededri/e5129d293ca6fdddc680194c1d9d75fe to your computer and use it in GitHub Desktop.
check unused SQLDelight queries
import re
# Define the file paths
sql_file_path = ""
kotlin_file_path = ""
# Read the SQLDelight file
with open(sql_file_path, 'r') as file:
sql_file_content = file.read()
# Extract the SQL query names
sql_query_names = re.findall(r'([a-zA-Z0-9_]+):', sql_file_content)
# Read the Kotlin file
with open(kotlin_file_path, 'r') as file:
kotlin_file_content = file.read()
# Check if each SQL query name is present in the Kotlin file
for query_name in sql_query_names:
if query_name not in kotlin_file_content:
print(f"The query '{query_name}' is not used in the Kotlin file.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment