Error when attempting to join relations across different databases

Abierto
#417 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
mysql, ruby, sql
Área
databases

Línea de trabajo

Start by reproducing the ROM.container setup with the two MySQL gateways and the cross-relation join shown in the issue. Trace the join entry point and SQL generation until you can identify where gateway or database qualification is lost; done means the generated SQL qualifies users with default and other_users with legacy as shown.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug help wanted

Describe the bug

We can't make the code for joining relations across different databases.

To Reproduce

Provide detailed steps to reproduce, an executable script would be best.

  1. setup the following code.
ROM.container(
  default: [:sql, 'mysql2://localhost/defalut'], # gateway 1 and has users table
  legacy: [:sql, 'mysql2://localhost/legacy']  # gateway 2 and has other_users table
) 
default_relation = rom.relations[:users]
other_relation = container.relations[:other_users]
  
p default_relation.join(other_relation, container.gateways[:default][:users][:id] => container.gateways[:legacy][:other_users][:default_id])
  1. Run the script
SELECT * FROM `users` INNER JOIN `other_users` on (`users`.`id` = `other_users`.`default_id`)

Expected behavior

We want to see the output

SELECT * FROM `default`.`users` INNER JOIN `legacy`.`other_users` on (`default`.`users`.`id` = `legacy`.`other_users`.`default_id`)

My environment

  • Affects my production application: YES
  • Ruby version: ...2.7.7
  • OS: Mac
Lenguaje dominante
Ruby
Estrellas
220
Forks
97
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de rom-rb/rom-sql

Todos los issues de rom-rb/rom-sql

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.