cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Generative AI
Explore discussions on generative artificial intelligence techniques and applications within the Databricks Community. Share ideas, challenges, and breakthroughs in this cutting-edge field.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Compound keys on Genie

JYvesLimantour
New Contributor III

Is it just me or Genieยดs generated SQL code failes to use composite keys -of the underlying related tables- as its default behavoir, regardless of the model having relationships declared explicitly.

Sometimes I have fixed this scenario by using an instruction -plain text-, sometimes by forcing the sql as an instruction but every time I have a new set of tables related by means of a composite key, Genie just won't use them as its default behavior. Then I have to juggle.

ยฟAre you experiencing this same behavior?

ยฟHow are you tackling it?

1 ACCEPTED SOLUTION

Accepted Solutions

SP_6721
Contributor III

Hi @JYvesLimantour 

Genie struggles with composite keys by design. A few things that might help:

  • Clearly define your primary and foreign key relationships in Unity Catalog.
  • Add example SQL queries that include composite joins to give Genie better context.
  • Include explicit join instructions in your Genie space when needed.
  • For more complex joins, you could try using materialized views, predefined joins, or even things like surrogate keys or hashed keys
  • For complex joins, you could try using materialized views or predefined joins.

View solution in original post

2 REPLIES 2

SP_6721
Contributor III

Hi @JYvesLimantour 

Genie struggles with composite keys by design. A few things that might help:

  • Clearly define your primary and foreign key relationships in Unity Catalog.
  • Add example SQL queries that include composite joins to give Genie better context.
  • Include explicit join instructions in your Genie space when needed.
  • For more complex joins, you could try using materialized views, predefined joins, or even things like surrogate keys or hashed keys
  • For complex joins, you could try using materialized views or predefined joins.

What has been useful the most is adding sql instructions using composite keys.

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now