bug(arrow-odbc): SQL Server event store index guard never matches
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 92/100
Research direction
Start in sqlspec/adapters/arrow_odbc/events/store.py at the CREATE INDEX regex and inspect the related rendering path. Update the table-name capture so it stops before the column list, then adjust tests/unit/adapters/test_arrow_odbc/test_tsql_stores.py and verify the rendered guard uses OBJECT_ID(N'[dbo]/app_events]').
Written by the indexing model from the issue text.
Description
The SQL Server event queue store in the arrow-odbc adapter wraps CREATE INDEX in an existence check that never matches. The index DDL runs again every time the store's DDL is applied, and fails if the index already exists.
Where
sqlspec/adapters/arrow_odbc/events/store.py: re.search(r"CREATE INDEX\s+(\S+)\s+ON\s+(\S+)", ...)
What happens
For CREATE INDEX idx_app_events_channel_status ON app_events(channel, status, available_at), the second \S+ captures app_events(channel, as the table name. The rendered guard is:
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = N'idx_app_events_channel_status'
AND object_id = OBJECT_ID(N'[dbo].[app_events(channel,]')) BEGIN CREATE INDEX ... END
OBJECT_ID(N'[dbo].[app_events(channel,]') is always NULL, so NOT EXISTS is always true.
Expected
OBJECT_ID(N'[dbo].[app_events]'). Stop the table-name capture at ( or whitespace, for example ON\s+([^\s(]+).
Note
tests/unit/adapters/test_arrow_odbc/test_tsql_stores.py currently asserts the rendered SQL as it is today, including OBJECT_ID(N'[dbo].[app_events(channel,]'). Update that assertion along with the fix.
- Dominant language
- Python
- Stars
- 102
- Forks
- 9
- Avg merge
- 8h 38m
- Merged PRs (30d)
- 64
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from litestar-org/sqlspec
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
litestar-org/sqlspec#815 ·
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
litestar-org/sqlspec#810 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
litestar-org/sqlspec#788 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
litestar-org/sqlspec#728 ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
litestar-org/sqlspec#509 ·
All issues in litestar-org/sqlspec
Similar issues
-
agent-ready documentation needs-triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
instance instance add
Difficulty 1/5 Under an hour Newbie friendliness 72/100
searxng/searx-instances#939 · 1 comment ·
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100