Skip to content

feat: safe sql#8

Merged
kemingy merged 2 commits intomainfrom
sql_safe
Mar 12, 2025
Merged

feat: safe sql#8
kemingy merged 2 commits intomainfrom
sql_safe

Conversation

@kemingy
Copy link
Member

@kemingy kemingy commented Mar 11, 2025

  • remove legacy code
  • support jsonb for pg, fix datetime to timestamptz
  • use psycopg string composition to make it safe
  • fix some type errors

- support jsonb for pg, fix datetime to timestamptz
- use psycopg string composition to make it safe
- fix some type errors

Signed-off-by: Keming <kemingyang@tensorchord.ai>
@kemingy kemingy requested a review from Copilot March 11, 2025 10:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR introduces safer SQL composition by migrating from legacy string formatting to psycopg’s SQL construction methods, while also removing deprecated code and updating type configurations.

  • Upgrade Python version and dependencies in pyproject.toml
  • Update SQL commands using psycopg’s sql module to prevent injection risks
  • Remove legacy files and adjust type hints and error handling in various modules

Reviewed Changes

File Description
pyproject.toml Updated Python version and dependency versions with additional mypy config
vechord/registry.py Refactored pipeline and table registration; added logging and minor typos
vechord/load.py Replaced placeholder pass with NotImplementedError
vechord/client.py Migrated legacy SQL string formatting to psycopg safely and updated select/insert
vechord/rerank.py Marked unimplemented method with NotImplementedError
vechord/init.py Removed legacy export references
README.md Updated documentation and docker command changes
examples/*, vechord/main.py Removed legacy examples and main entry point
vechord/model.py Removed deprecated Chunk class
vechord/chunk.py Added type annotations for clarity
vechord/evaluate.py Updated type hints to utilize Sequence instead of list
vechord/spec.py Added jsonb support and adjusted datetime mapping; improved error handling
vechord/pipeline.py Legacy pipeline file removed

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

vechord/registry.py:45

  • The variable name 'vector_colume' appears to be misspelled. Consider renaming it to 'vector_column' for clarity.
if vector_colume := table.vector_column():

Signed-off-by: Keming <kemingyang@tensorchord.ai>
@kemingy kemingy requested a review from VoVAllen March 12, 2025 07:34
@kemingy kemingy merged commit 3e08af3 into main Mar 12, 2025
2 checks passed
@kemingy kemingy deleted the sql_safe branch March 12, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants