Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: database and deployment questions

by hippo (Bishop)
on Oct 19, 2021 at 09:06 UTC ( [id://11137712]=note: print w/replies, xml ) Need Help??


in reply to Newbie question

Hello, SpaceCowboy. Welcome to the Monastery.

Is there a way to encrypt a Perl file containing password?

There are many ways to encrypt a file in Perl - the real question is how do you decrypt it again? That will require a password and it will need to be stored somewhere, say in a file which then needs to be encrypted, and so ad infinitum. See How can a script use a password without making the password visible? and Password encryption for discussion of some approaches to this.

can I import a million rows and transpose, rename, transform and do a bunch of joins -- is this possible in Perl?

Yes, but why would you? As you say SQL is likely the better tool for this, that's why we have databases. Your reason for avoiding the database seems vague to me. Why not try the SQL approach and if you need help re-framing the results that could be another question.

any advice on books on perl deployment practices?

I'm not aware of any books specifically about that but deployment is touched on in various other books and articles. You might find the "Managing Real Programs" chapter of Modern Perl to be useful, for example.


🦛

Replies are listed 'Best First'.
Re^2: database and deployment questions
by SpaceCowboy (Acolyte) on Oct 19, 2021 at 21:58 UTC
    Thank you @hippo for your response. I have data from more than one database and needed to bring them over to drop, rename, perform calculations, joins and export it as flat file... does not seem possible with SQL alone, need some kind of "pandas" environment; I am willing to learn and try other approaches - storing millions of rows and hundreds of columns in 2d array if possible... any advice on books related to data tables processing?

      I would still be looking to do all that within an RDBMS.

      storing millions of rows and hundreds of columns in 2d array if possible

      Sure it's possible - if you have enough memory. I just don't see why you would do that when a database is the right tool for the job. There is nothing you have said here to suggest to me that it isn't.


      🦛

        so how would one go about joining tables from multiple data sources without database links and without temp tables...

      Perl arrays and hashtables support nesting (e.g. hash-of-hash-of-array-of-hash etc.), mixed "data types" and slices (a convenient form of indexing). There is also PDL if your data is numeric. Additionally, there is Inline::Python if you want to inline python code you already have (untested by me).

      storing millions of rows and hundreds of columns in 2d array if possible

      well that's illegal in some states and some of us Perl-ers still work on Spectrums, :)

      Update: There's also DBIx::Array which offers this:

      foreach my $row ($dbx->sqlarrayhash($sql, @bind)) { do_something($row->{"id"}, $row->{"column"}); }

      And there's DBIx::Class as a long-term investment.

      bw, bliako

        Thank you! this seems like a start. While I would try to get as much as done in SQL way, there are some things like transformations, transposes, joins I really wish I could do it in Perl. Is there a package that would do cross-tab or pivot table in Perl? I found Data::Pivot and would love to test out others when I get a chance...
      I have data from more than one database and needed to bring them over to drop, rename, perform calculations, joins and export it as flat file

      That sounds like a use for a Temporary Table in the RDMS to me...

        can you please elaborate, I'd like to learn from you

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11137712]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2024-04-23 08:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found