K
Kysely

help

Cross database joins in MySQL

Oohmi5/22/2023
Hi all,
Is it possible to do joins across databases within the same MySQL instance?
i.e
SELECT * FROM db1.table1 INNER JOIN db2.table2 ON db1.table1.id = db2.table2.id

I've generated the typings for both databases, but not sure if there's a way to leverage them?
IIgal5/23/2023
Hey πŸ‘‹πŸ»

I thought I pointed that schemas might work here in another thread.. πŸ˜•
Glad you found the answer!
Oohmi5/23/2023
i may have potentially overlooked that, because i wasnt aware of what 'schemas' in pg were πŸ˜… . ended up ctrl f'ing through this server for 'multiple database' and found the same thing. hopefully this thread also helps with the discoverability for future mysql people

Looking for more? Join the community!

Recommended Posts
.where('x', 'is not', null) and correspond type's nullabilityNot sure if this even possible in typescript (although all of the work Kysely already makes it seem What is the suggested way of adding/removing methods to expression builders?Context: I am building a custom dialect for YDB https://github.com/Gaspero/kysely-ydb YDB is slightlRunning database agnostic queries (MySQL)As part of my test suite, I drop/create databases programmatically. Is it possible to have a Kysely Asserting type of .countAll() (MySQL)I've noticed that the return type from the result of aggregation functions like `countAll()` and `suCoalesce return empty arrayHey is there a way to return an empty array rather than `null` when an array column is empty? I alrkysely-codegen for multiple databasesI have two MySQL 'databases' within the same instance. From the documentation, it doesn't look like Using MySQL functions in SELECT statementHi! Just trying to migrate over from Knex. Skimmed over the documentation but still unsure of how tExtract OrderBy TS KeysHey I have the following query ```ts const getBaseQuery = ({ offset, pageSize, slug }: GetBaseQuerinsert into with mix of static and table valuesHow might I execute an insert into that combines JS-side values with a select, like: ``` INSERT INTOMigration error "TypeError: Cannot read properties of undefined (reading 'getExecutor')"I am trying to run a migration using Kysely, and its returning this error: ``` file:///Users/brunocrwhere clause with lengthHow do I have a where clause with a length, e.g. `select * from data where length(prodcode) = 3`show generated sqlhow can i see what the generated sql is for a kysely query? e.g. ``` result = await db.selectFrom("