Skip to content

Commit

Permalink
Fix/db view names (#8119)
Browse files Browse the repository at this point in the history
* Fix to case sensitive DB Views name

* Fix to case sensitive DB View names

* Added quotes to check query as well

* Added quotes to create view query
  • Loading branch information
ma-armenta authored Feb 1, 2025
1 parent 44c82a2 commit e36dc54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions db_scripts/create_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ async def check_view_exists(): # noqa: PLR0915
print("MonthlyGlobalSpendPerUserPerKey Created!") # noqa

try:
await db.query_raw("""SELECT 1 FROM DailyTagSpend LIMIT 1""")
await db.query_raw("""SELECT 1 FROM "DailyTagSpend" LIMIT 1""")
print("DailyTagSpend Exists!") # noqa
except Exception:
sql_query = """
CREATE OR REPLACE VIEW DailyTagSpend AS
CREATE OR REPLACE VIEW "DailyTagSpend" AS
SELECT
jsonb_array_elements_text(request_tags) AS individual_request_tag,
DATE(s."startTime") AS spend_date,
Expand Down
4 changes: 2 additions & 2 deletions litellm/proxy/db/create_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ async def create_missing_views(db: _db): # noqa: PLR0915
print("MonthlyGlobalSpendPerUserPerKey Created!") # noqa

try:
await db.query_raw("""SELECT 1 FROM DailyTagSpend LIMIT 1""")
await db.query_raw("""SELECT 1 FROM "DailyTagSpend" LIMIT 1""")
print("DailyTagSpend Exists!") # noqa
except Exception:
sql_query = """
CREATE OR REPLACE VIEW DailyTagSpend AS
CREATE OR REPLACE VIEW "DailyTagSpend" AS
SELECT
jsonb_array_elements_text(request_tags) AS individual_request_tag,
DATE(s."startTime") AS spend_date,
Expand Down

0 comments on commit e36dc54

Please sign in to comment.