Terry Lee
AEAsh Elixir
•Created by Terry Lee on 7/15/2023 in #support
Full debug SQL
Hi, during development, the sql statement is printed out by the
AshPostgres.DataLayer.run_aggregate_query/3, at: lib/data_layer.ex:738
A long enough sql would be truncated. How do I get the full sql without truncation?
Thanks!2 replies
AEAsh Elixir
•Created by Terry Lee on 7/10/2023 in #support
How to put the same value at multiple places in a fragment?
Say I have a custom postgres function and
Is it possible to do the following fragment
fragment("SELECT my_custom_function(1/<rate>, 2/<rate>, 3*<rate>) FROM lookup_values WHERE id=<id>", rate, id)
?
Today, I will need to do fragment("SELECT my_custom_function(1/?, 2/?, 3*?) FROM lookup_values WHERE id=?", rate, rate, rate, id)
3 replies
AEAsh Elixir
•Created by Terry Lee on 7/9/2023 in #support
How do you sort by substring?
Current in my resource
I would like to sort by substring ->
select * from resources order by substring(sale_reference from 3) desc
4 replies
AEAsh Elixir
•Created by Terry Lee on 5/24/2023 in #support
JsonB sorting within Resource.actions
I have a Resource with a jsonb column called
metadata
How do I default sort by `metadata ->> 'CreatedDate'?
16 replies
AEAsh Elixir
•Created by Terry Lee on 5/21/2023 in #support
JSONB <=> Map fails on Array
I have a column of type
jsonb
. Let's call this column metadata
In my resource, I define the attributes as
If my metadata
is a json element, the data is returned properly.
However, if the metadata
is an array of json elements, the Ash Query fails.
Sample error response
2 replies
AEAsh Elixir
•Created by Terry Lee on 5/15/2023 in #support
Skip Migration for a Resource
Question: How do I skip generation of migration for a particular resource?
Context,
I have an existing ongoing project that I want to port over to STAPLE. The project
1. has existing tables and data in production. The migrations are separately maintained using LIquibase
2. has views that combines data from multiple tables from multiple schemas.
I'd like to define the tables and views as Ash Resources.
Firstly, can do? I'm assuming that i can just put the name of the view into the
table
element in postgres
.
Secondly, hence, how do I skip migration generation for these resources entirely? Though I would like to generate new tables
Third question, do I use
OR
I'm gonna give the above a go anyways. Just wanna ask for pointers. And I couldn't find where I can skip migration of entire resource. Cheers!4 replies
AEAsh Elixir
•Created by Terry Lee on 5/8/2023 in #support
Self-referencing a Resource
Question: How do I self-reference a Resource?
Detail Description: I have a Person table. I want to describe that he is related to another Person(s). I don't need to know relationship type, except that they are related/know each other
Technical Description: Person A :has_many Persons(s) ?
2 replies