You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a rewriting rule, and I need information about integrity constraints such as primary key or foreign key.
let sql_query = " select p.*, CONCAT(first_name, ' ', last_name) from people p join department d on d.did = p.did where first_name = 'Jiri' and last_name = 'Prochazka';";// first set up the configletmut config = SessionConfig::default();let ctx = SessionContext::new_with_config(config);
ctx.sql("CREATE TABLE department (\ did INT PRIMARY KEY,\ name VARCHAR(50), \ year_started INT, \ year_ended INT \ )").await?.collect().await?;
ctx.sql("CREATE TABLE people ( \ pid INT PRIMARY KEY, \ first_name VARCHAR(50), \ last_name VARCHAR(50), \ did INT NOT NULL \ )").await?.collect().await?;let logical_plan = ctx.sql(sql_query).await?.into_optimized_plan()?;
I considered adding Constraints struct into DFSchema since DFSchema is available in LogicalPlan. Another change I need is that the Foreign Key variant has to be added to the Constraint enum. Is there any better solution to this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm writing a rewriting rule, and I need information about integrity constraints such as primary key or foreign key.
I considered adding Constraints struct into DFSchema since DFSchema is available in LogicalPlan. Another change I need is that the Foreign Key variant has to be added to the Constraint enum. Is there any better solution to this?
Beta Was this translation helpful? Give feedback.
All reactions