Does it make sense to store sql table names in a hash

Not to me, it makes your SQL impossible to read without refering to your index hash.

... or hardcode the names in your script?

They have to be written somewhere. They ARE hardcoded into the DB schema.

In the beginning there was the schema. And the chief architect saw that it was good and said unto his minions, go forth and code this schema for it is inviolate and it will not changed. And though the minions wanted desperately to believe the chief architect they knew that the schema would change.....

As so after 40 days and 40 nights it became evident that column X was missing from table Y.....

I expect dealing with this sort of sitation is what you are really talking about. Some of the ways to deal with this eventuality include avoiding select * and always selecting specfic colums, same for updates and inserts. That way adding a column is less of an issue. Abstracting DB access to varying degrees also makes sense. At if simplest you might just put all the DB access code into its own module so at least you have one place to do most of the work in the event of changes to the schema.

cheers

tachyon


In reply to Re: Sql table names by tachyon
in thread Sql table names by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.