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

[Experimental] Support for prisma #1220

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft

[Experimental] Support for prisma #1220

wants to merge 13 commits into from

Conversation

SferaDev
Copy link
Member

@SferaDev SferaDev commented Oct 11, 2023

TODO:

  • Testing
  • Proper type conversion (I've removed a lot that will need to be handpicked)
  • Add support for wire protocol via websockets

@changeset-bot
Copy link

changeset-bot bot commented Oct 11, 2023

⚠️ No Changeset found

Latest commit: 841feab

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 11, 2023

size-limit report 📦

Path Size
packages/client/dist/index.mjs 17.94 KB (+0.08% 🔺)
packages/client/dist/index.cjs 19.29 KB (+0.08% 🔺)
packages/codegen/dist/index.mjs 2.58 MB (+0.01% 🔺)
packages/codegen/dist/index.cjs 2.58 MB (+0.01% 🔺)

Signed-off-by: Alexis Rico <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Oct 12, 2023

Your pull request has been published to npm.

You can install @xata.io/client by running:

npm install @xata.io/[email protected]

Other packages are published like this:

npm install @xata.io/[email protected]

To test the CLI, run:

npx @xata.io/[email protected]

[Pull request has been updated, please wait for latest changes to be pushed to npm...]

@janpio
Copy link

janpio commented Oct 13, 2023

👋 Heyho from Prisma.

If you want, you can do a temporary PR similar to prisma/prisma-engines#4342, which should make it simpler to run the Prisma test suites against the driver adapter. We are unfortunately not ready yet with a more general approach for that, but I am happy to work with getting that run in this temporary way. (Unless of course you have figured out a better way already)

@SferaDev
Copy link
Member Author

Hey @janpio!

We indeed want to move our adapter to prisma-engines, I actually took a heavy inspiration from the existing ones when building the first version.

We are currently working on polishing some parts of our postgres connector internally, and we would like to finish that before moving the code to your side. (For example, right now we are injecting to the adapter the schema, but we want to forward the postgres row metadata via the http adapter, in order that joins and projections fully work).

Happy to connect via email or GitHub if you have any suggestions 😉

@janpio
Copy link

janpio commented Oct 27, 2023

Actually, the driver living in your repo is the right spot - but temporarily (via a PR) having a copy in our test setup can be useful for you I think. But we are currently also moving things around (soon the driver adapters live in prisma/prisma...), so maybe we wait a few days until we tackle that.

How do you think about transactions? As far I know your client does not support that yet. Many Prisma Client queries use transactions under the hood (at least as soon as the queries become a tiny bit complex). Would you want those to be not working, or are you ok skipping the transaction guarantees for your users?

@SferaDev
Copy link
Member Author

We are working to offer full postgres compatibility, including transactions in the near future. We will even expose a TCP wire protocol connection string and likely have two adapters HTTP and wire protocol. But all of that is blocked until we ship the full thing.

Comment on lines +35 to +42
const [columnNames, columnTypes] = Object.fromEntries(columns as any).reduce(
([names, types]: [string[], ColumnType[]], [name, { type_name }]: [string, { type_name: string }]) => {
names.push(name);
types.push(fieldToColumnType(type_name));
return [names, types];
},
[[], []] as [string[], ColumnType[]]
);
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: Improve this

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

Successfully merging this pull request may close these issues.

3 participants