lejoko
MySQL connector for Ash?
Hi,
I work for a small MVNO and I’m very much interested to try using Ash in our internal devs. However I have a (probably) breaking requirement : I need to be able to connect it to our MySQL 8.0 (Actually Percona XtraDB) cluster. Is there something in the making ? I heard about that in the past, but did not found anything up to now.
I might be interested in having a try at making a MySQL connector myself, but I’m not sure where should I start ?
Trending in Questions
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated!
To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead.
Sta...
New
Hello !
We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security










First Post!
zachdaniel
ash_sqliteintoash_mysqland start making modifications to get the tests passing. What will likely additionally need to happen is that theAshSqlimplementation will need to be expanded to account for whatever special thing isn’t supported byMost Liked
lejoko
Ok, all tests that came from ash_sqlite are now passing. It should currently work almost like ash_sqlite but without upserts and only when using primary keys generated by ash. Primary keys autogenerated by MySQL (AUTO_INCREMENT) should probably also work but not for bulk insert/update. I’ve not yet added a verifier to enforce those restrictions. Up to now, I’ve worked only on making tests pass, so I’ve not really tested the module in a real app. I’m just now starting to play with it in an app in order to “feel” how it works.
Moreover, I’ve had a look at how ash_postgres does transactions (and custom errors) and it looks like it should be doable with MySQL. Hopefully I’ll be able to add it later. I’ve not yet had a serious look at aggregates.
If my tests go well (and when an official ecto_sql release include my fix) I will probably make a first release. Would you (@zachdaniel) like to have ash_mysql as an “official” part of ash ? After all, it is still mostly your code (from ash_sqlite), my changes are not the biggest part… Anyway, I’ve left almost all of the ash project “branding” that came from ash_sqlite in the repo for now. I’d be happy if it could be “absorbed” officially in the ash project. What is your view on that ? I’m not sure which way to go in this regard.
zachdaniel
So the plan from here will essentially be:
Thank you for your excellent work!
lejoko
MySQL does not have a way to return the result of an insert. It returns only the number of inserted records.
If you rely on auto generated primary keys (
AUTO_INCREMENTin MySQL terms, which is the default for most people), there is a way to get it back wit a call to theLAST_INSERT_ID()function; You could then load the record back. However that would work only for an insert of a single record. For bulk inserts, that function returns only the id of the first inserted record, and there is no reliable way to get the ids of the other records (they might be guessable in simple cases, but it would break in a lot of clustering configs).The only way around that would be to generate the primary key on the app side and load the records afterward or to not rely on that ability…
Last Post!
lejoko
Exactly. Thank you for Ash! It’s great!