sahilpaudel
** (MatchError) no match of right hand side value - Redshift
I am not able to connect to redshift db getting following error
(exit) an exception was raised:
** (MatchError) no match of right hand side value: {:ok, %Postgrex.Query{cache: :reference, columns: ["count", "query"], name: "", param_formats: [], param_oids: [], param_types: [], ref: #Reference<0.1270814240.2812542977.191519>, result_formats: [:binary, :binary], result_oids: [20, 1043], result_types: [Postgrex.Extensions.Int8, Postgrex.Extensions.Raw], statement: "SELECT *\nFROM ( SELECT count(*) as count, lower(event_props_typed_string) as query\nFROM \"pe_consumer_ct\".\"l_typeahead\" \"c\"\nWHERE (\"c\".\"created_at\" > (current_date - INTERVAL '30 days')) and event_props_typed_string is not null\ngroup by event_props_typed_string\nhaving query != ''\norder by count desc\n\n ) \"s\" LIMIT 2000", types: {AfterGlow.PostgrexTypes, #Reference<0.1270814240.2812674049.191315>}}, %Postgrex.Result{columns: ["count", "query"], command: :select, connection_id: 49183, messages: [], num_rows: 2000, rows: [[17556, "condom"], [14780, "dettol"], [13838, "mask"], [11343, "hor"], [9502, "vicks"], [9438, "sex"], [9332, "horlicks"], [9192, "ensure"], [8877, "pan 40"], [8680, "pan"], [8558, "eno"], [8418, "evion"], [7864, "dett"], [7505, "vitamin e"], [7332, "volini"], [7246, "limcee"], [6481, "cerelac"], [6171, "sanitizer"], [6047, "dolo"], [5987, "zincovit"], [5960, "para"], [5815, "telma"], [5669, "shelcal"], [5631, "pan d"], [5627, "vitamin d"], [5593, "a to z"], [5464, "eco"], [5393, "crocin"], [5387, "calcium"], [5302, "viagra"], [5233, "omez"], [5170, "mintop"], [5161, "ceta"], [5134, "minoxidil"], [5114, "ultracet"], [5103, "cetaphil"], [5056, "horli"], [5019, "vitamin"], [4851, "uprise"], [4817, ...], [...], ...]}}
(afterglow) web/modules/sql/adapters/redshift.ex:166: AfterGlow.Sql.Adapters.Redshift.run_query/5
(afterglow) web/modules/sql/query_runner.ex:29: AfterGlow.Sql.QueryRunner.run_raw_query/4
(afterglow) web/controllers/query_controller.ex:31: AfterGlow.QueryController.execute/2
(afterglow) web/controllers/query_controller.ex:1: AfterGlow.QueryController.action/2
(afterglow) web/controllers/query_controller.ex:1: AfterGlow.QueryController.phoenix_controller_pipeline/2
(afterglow) lib/afterglow/endpoint.ex:1: AfterGlow.Endpoint.instrument/4
(phoenix) lib/phoenix/router.ex:278: Phoenix.Router.__call__/1
(afterglow) lib/afterglow/endpoint.ex:1: AfterGlow.Endpoint.plug_builder_call/2
(afterglow) lib/plug/debugger.ex:122: AfterGlow.Endpoint."call (overridable 3)"/2
(afterglow) lib/afterglow/endpoint.ex:1: AfterGlow.Endpoint.call/2
(plug_cowboy) lib/plug/cowboy/handler.ex:18: Plug.Adapters.Cowboy.Handler.upgrade/4
(cowboy) /Users/sahilpaudel/Documents/PharmEasy/Elixir/forked/AfterGlow/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4
This is where the error is happening
defp run_query(conn, query, exec_query, limited, frontend_limit) do
try do
query = Postgrex.prepare(conn, "", exec_query, opts)
case query do
{:ok, prepared_query} ->
{:ok, results} = Postgrex.execute(conn, prepared_query, [], opts) // error here
{:ok,
%{
columns: results.columns,
rows: results.rows,
limited: limited,
limit: frontend_limit,
limited_query: exec_query
}}
{:error, error} ->
{:error, error.postgres}
end
rescue
DBConnection.ConnectionError ->
{:error, %{message: "Query Timed Out. Please Try to optimize your query"}}
end
end
Any help please.
Marked As Solved
yreuvekamp
The format seems to be:
{:ok, query, result}
instead of
{:ok, result}
1
Popular in Questions
can someone please explain to me how Enum.reduce works with maps
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”:
14:57:30.512 [warn] ...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
Hi guys, nice to meet you to the whole forum, I’m new here, I’m trying to configure visual studio code for elixir, right now the intellis...
New
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
Other popular topics
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
In Ruby, I can go:
User.find_by(email: "foobar@email.com").update(email: "hello@email.com")
How can I do something similar in Elixir? ...
New
Hello all!
I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set?
Thanks.
New
Hi,
I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Hi everyone,
One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New







