tschnibo

tschnibo

Hey :slight_smile:
Just spent a day on finding out how to handle dependency problems when I need two different versions of one package. I am aware that there is always the option to create my own package.

Nevertheless, what I ended up doing was:

I guess for most people this is not really a challenge… first timers are always harder. Nevertheless I wanted to ask if there is a better way. (From the other entries here I don’t think so).
I don’t really like that I end up having a forked version without an other reason besides the renaming.

Is this such a rare case that one has/wants to do so?

Could one write maybe a @before_compile Macro or something similar in order to automatically rename some dependencies or keeping them “private” respectively?
Maybe based on an “alias” or “namespace” tag in the mix.exs file.

My guess is that this would lead to more complexity and therefore the “forking” approach is considered better. And I have no clue how this would work, just out of curiosity.
Cheers

Showing Posts 9 to 1

tschnibo

tschnibo OP

Update: looks easier than expected again (one has to love elixir libraries): there is a few :unicode.characters_to_binary(:unicode, :latin1)
in the type casting of mssqlex. using utf8 instead seems promising. Not tested for inserts or timestamps yet… but I am positive that this all can be achieved :smiley:

tschnibo

tschnibo OP

Correction: at the moment the result parsing works seemingly again. I don’t understand what version of which part of my setup (umbrella) caused the problem earlier… I guess I was running on earlier compiled stuff still or similarly. In oder to get correct strings I have to “normalize” them like this:

I have to call SELECT NORMALIZE('Å', 'NFC') FROM ... for the string variables in order to get the proper encoding… but this is not a problem for my read only queries…, just maybe something to optimize.

I guess this is something Hana specific, or would you know such a pattern, is that an “encoding” thing which I also could solve via the Driver?

I’ll have to do some testing, and then maybe just to approach the MssqlexV3 People. Just, you seem to have some SQL experience. Best, Tschnibo

Edit: I see that I have to read on here: https://hexdocs.pm/elixir/master/unicode-syntax.html#r6-filtered-normalized-identifiers

tschnibo

tschnibo OP

@kip , you are totally right. But one persons hard work would be maybe a simple task for others. I guess that extent of patching I did would require other people 5 min max.

I just installed a configurable “ping” statement and a “configurable” Connection key (to map “Server” → “servernode” I think).

What I want to say, the whole thing basicly just connects. And what is missing (what was working for the older mssqlex beliefe) is the parsing of the results into maps. Also I have not tried writing or something similar. But I probably (not 100% sure) look into this things too, at least the parsing. And if this would be slightly more involved and I would succeeded, then this might get to a level where a PR or public Fork or whatever would become interesting. Of course if somebody else would require a Hana connection, this could be a motivation - or this person could maybe help me with my limited skills.

Anyway, thank you, you are motivating me to dig a bit deeper!

kip

kip

ex_cldr Core Team

If as a result of your hard work you have a patch that makes it possible to use MSSQLex with SAP HANA then I’m sure the maintainers would be interested in a PR.

Its definitely not a mainstream open source DB but as someone who spent 10 years at SAP I know its a platform that enterprises spend a lot of $$$$ on so perhaps an opportunity for enterprising Elixir developers.

tschnibo

tschnibo OP

Small update :slight_smile:
It was a mistake in my patch which prevented me from using MssqlexV3 for Hana too.
Now that is fixed I do get my connections as desired. So back to one mssqlexV3 version (patched) and correspondingly to one DBConnection dependency. :smiley:

Do the “do you really need two different versions” people always win at the end? :rofl:

Still glad for learning a lot by renaming modules and stuff :smiley: Good to know that such a dependency issue is not a dead end.

tschnibo

tschnibo OP

Thank you for thinking through and for this idea!

Actually I might even sometimes have thought about something in this direction. But at the moment this would be “over my head” and maybe as you said complicated in another way. Especially for developing, I would need to run one app separately adding sort of an “API-Layer”. If I understand this correctly. Then again I would learn about nodes… :smiley:

I also had a look at umbrella projects, but they are explicitly no suited for that problem.

So the forks are maybe really “the way to go”. What I was thinking: could one write an slightly adapted compiler / compiler plugin which takes a mix.exs or config file entry and prepends / renames specific module names accordingly? I mean I just did the whole forking stuff, no real need right now. I am more just thinking if there could be a simple solution. The larger the ecosystem gets, the more such “dependency problems” can occur I assume. What strikes me is on one hand, that the problem can be solved by renaming a package and on the other hand that it is solved that way. But of course I see that every added complexity to core functions as compilation do make the whole thing more complicated…

hubertlepicki

hubertlepicki

Right. So there’s one more option but I am not sure if it’s any more less terrible than what you figured out. Maybe, maybe not. You could set up non-homogenous Erlang/Elixir cluster where one node has an app loaded on it that talks to sap-hana, and other node has deployed app that talks to microsoft-sql…

Again, I am not saying it’s a good solution as it’s got it’s own set of problems in set up like that, starting with way more complicated deployment scenario, but it would be an alternative to what you do.

tschnibo

tschnibo OP

fair :slight_smile: I use mssqlex in the “original” version which comes with db_connection v1.1 for sap-hana
(just because it works with only minor changes) and then the mssqlex_v3 package which depends on db_connection v2.0 for Microsoft-SQL.. I only read on the DB’s. Internally I use mongdb at the moment.

hubertlepicki

hubertlepicki

out of curiosity: which package you had the need to have included twice in the project?

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
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
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews