dmitriid
One current limitation of the excellent sqlite3 adapter is schemaless queries: Ecto.Adapters.SQLite3 — Ecto SQLite3 v0.24.1
Using schemaless Ecto queries will not work well with SQLite. This is because the Ecto SQLite adapter relies heavily on the schema to support a rich array of Elixir types, despite the fact SQLite only has five storage classes. The query will still work and return data, but you will need to do this mapping on your own.
There’s an open issue to add examples for such mapping: Add examples to documentation for schemaless queries with mappings · Issue #14 · elixir-sqlite/ecto_sqlite3 · GitHub
I was wondering: does any one have examples of how these queries would look? (And these could be added to documentation perhaps)
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
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
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 3- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
dimitarvp
I’ve thought about this the last year (when I still thought I’ll have time and energy for
xqlite) and the only two options I could figure out back then were these:Utilize SQL comments in the table/view DDLs in the manner described in this SO answer: https://stackoverflow.com/a/7426289/285154. Ideally you’d want this to be DBML or some instance of XML so it absolutely can’t be gotten wrong but really, anything would work.
Have a special table inside your schema a la
schema_migrationsfor Ecto. For my library I am planning to call itxqlite_metadatabut I might get bolder and use some more generic naming likesqlite_typing_info. And then you put whatever you like in that table. Of course this has to come with a HUGE WARNING in your docs: “Don’t delete this table or the library won’t work properly!” but what can you do? Developers are, on average, better users than the non-technical people so this should mostly be fine. I mean, I am not seeing people deliberately deleting theschema_migrationstable after all.I am leaning to #2 because, if done well, it can be reused even by other libraries so we could all stop reinventing the same wheels. And if done really well then one day it could be used by sqlite3’s authors to finally start and gradually integrate strict types in the engine. Who knows. It might happen!
dmitriid
Hmmm… I like the idea. But how would then you’d use that in a schemaless query?
Currently when you do a schemaless query with the sqlite3 ecto adapter, it tries to figure out the types and may have weird results
dimitarvp
Almost exactly like you mentioned. Instead of the library trying to guess the types, it will consult this extra table containing the typing information. It could work.
I never got quite as far as actually implementing it but it was a little over a year ago when I wrote a small prototype in Rust that complemented its
rusqlitelibrary and it seemed to work fine on a first glance.