Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Rename "table" to "table_name" and switch to REGCLASS for better schema handling #163

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

varshith257
Copy link

@varshith257 varshith257 commented Oct 19, 2024

Closes #145
/claim #145

@varshith257
Copy link
Author

To ensure backward compatibility I have added into new migration file

@varshith257
Copy link
Author

@ChuckHend I am not pretty about schema param removal. Can you check it out that what you are expecting?

@ChuckHend
Copy link
Member

@ChuckHend I am not pretty about schema param removal. Can you check it out that what you are expecting?

What i am wondering is if we still need the schema parameter, or can we determine schema from the oid?

@@ -21,6 +21,7 @@ lazy_static = "1.4.0"
log = "0.4.21"
ollama-rs = "=0.2.1"
pgmq = "0.29"
pgrx = "=0.12.5"
Copy link
Member

Choose a reason for hiding this comment

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

remove pgrx from ./core/Cargo.toml. Core is separate so we can have a library that has no dependency on pgrx or any postgres service side.

Copy link
Author

Choose a reason for hiding this comment

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

for PgOid we need it if we support

Copy link
Member

@ChuckHend ChuckHend Oct 19, 2024

Choose a reason for hiding this comment

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

the only place PgOid type would be used is on the vectorize.table() outer most function, in the signature and then using it to determine table and schema, right? everything else could refer to either schema.table as a string or schema and table as separate strings would be ok too i think.

@varshith257
Copy link
Author

But removing schema param going on rabbit hole

@@ -239,7 +239,7 @@ fn append_embedding_column(job_name: &str, schema: &str, table: &str, col_type:
)
}

pub fn get_column_datatype(schema: &str, table: &str, column: &str) -> Result<String> {
pub fn get_column_datatype(table: &str, column: &str) -> Result<String> {
Copy link
Member

Choose a reason for hiding this comment

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

i think here we still need the schema parameter so that we can determine the data type of the specified column. otherwise, if two tables with same name but different schema, we will get multiple values in the result.

@varshith257
Copy link
Author

varshith257 commented Oct 19, 2024

@ChuckHend I think we need the schema parameter. Can I proceed with only renaming the table?

@@ -28,14 +27,16 @@ pub fn init_table(
// cron-like for a cron based update model, or 'realtime' for a trigger-based
schedule: &str,
) -> Result<String> {
let table_name_str = pg_oid_to_table_name(table_name);
Copy link
Member

Choose a reason for hiding this comment

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

I am hoping that we can determine the schema from the oid too. so maybe we have a let schema = pg_oid_to_schema() or something similar here

@ChuckHend
Copy link
Member

@ChuckHend I think we need the schema parameter. Can I proceed with only renaming the table?

can the table parameter be replaced with something that would instead accept the schema qualified table name as a postgres oid type, so that we can use the type to validate the input and collapse the table and schema parameters into a single parameter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rename vectorize.table "table" parameter
2 participants