Skip to content

Commit

Permalink
Postgres dialect
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-finley committed Apr 11, 2024
1 parent 1c5a23c commit 6678075
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions process_file/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def run(event, context):
)
query = """
INSERT INTO dropbox (desktop_path, filename, status)
VALUES (%s, SUBSTRING_INDEX(%s, '/', -1), 'done')
ON DUPLICATE KEY UPDATE status = 'done'
VALUES (%s, SPLIT_PART(%s, '/', -1), 'done')
ON CONFLICT (desktop_path) DO UPDATE SET status = 'done'
"""
with psycopg.connect(os.environ["NEON_DATABASE_URL"]) as conn:
with conn.cursor() as cursor:
Expand Down
2 changes: 1 addition & 1 deletion queue_files/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def run(event, context):
print(f"Queueing {clean_name}")
query = """
INSERT INTO dropbox (desktop_path, filename, status)
VALUES (%s, SUBSTRING_INDEX(%s, '/', -1), 'pending')
VALUES (%s, SPLIT_PART(%s, '/', -1), 'pending')
ON CONFLICT (desktop_path) DO NOTHING
"""
with conn.cursor() as cursor:
Expand Down

0 comments on commit 6678075

Please sign in to comment.