[Elixir] How to remove "" from a string, and convert it a variable?

This is the file I am working on. I hope you squint it a moment.

Look for how to seed a database in elixir or any other lang. You want to change your approach a bit.
In real world scenarios you wont have a use case where your code will dynamically create variables not knowing how to reference them

2 Likes

Do you have a link to the dataset of those people? Or a reduced – or anonymised – version of it?

It’s really easy to do what you want to do in Elixir (and in many other languages). But you are definitely not approaching this in a functional programming way.

If you give us a link to [part of] the data, we can show you how to do it.

3 Likes

In any language, ever, if you need to have a1, a2, etc. and access them by the number, then you should use any sequence container - array, list, vector, whatever given language have. Your approach is big no-no in any language.

2 Likes

What about Mockaro? would you show me a use case using it?

Huh? What has that got to do with your original question? Seems unrelated.

1 Like
  1. That seems to provide a CSV rather than a Google sheet.
  2. We still do not know how your database schema looks like.
  3. We don’t know how you build cross-reference in your data set, as you have users, buyers, sellers, products, etc…

What you have here is a regular ETL job.

  • extract data from a source
  • ttransform it into a new shape to suite your needs
  • load it into your target database

Also you should clearly define your problem here, how is your data shaped, where does it come from, how shall it be shaped and where does it go to, rather than asking for variable variable names and extending complexity of the problem with every second post you do.

The first problem had been easy to solve just by iterating over a single list. Though after you have cross references and various data types, unspecified how they belong together… We can’t help you with that without knowing the real details.


PS: the hard thing about ETL is not knowing the language to implement it, but in fact it is that you have to keep the specification for two versions of the data in mind at the same time and you are not allowed to confuse them ever.

1 Like

I know there is a good book called Programming Ecto: Build Database Apps in Elixir for Scalability and Performance.
I had better read it before writing the necessary code. Thank you all for good advices.