9 votes

Fortnightly Programming Q&A Thread

General Programming Q&A thread! Ask any questions about programming, answer the questions of other users, or post suggestions for future threads.

Don't forget to format your code using the triple backticks or tildes:

Here is my schema:

```sql
CREATE TABLE article_to_warehouse (
  article_id   INTEGER
, warehouse_id INTEGER
)
;
```

How do I add a `UNIQUE` constraint?

6 comments

  1. [2]
    Comment deleted by author
    Link
    1. joplin
      Link Parent
      The answer is going to come down to who you apply to and what their preferences are. To me, as someone who has input to the hiring process at my company, I'd prefer to see in order of importance:...

      The answer is going to come down to who you apply to and what their preferences are. To me, as someone who has input to the hiring process at my company, I'd prefer to see in order of importance:

      1. Relevant work experience at an actual company (I don't need to know whether it was paid or not)
      2. Relevant experience on a side project, even better if I can actually look at the source on github/gitlab/whatever
      3. Unrelated experience at an actual company showing you can at least deal with working in a company structure

      Whatever you decide, just be sure to tailor your resume to the company you're applying to if you want to increase your chances.

      3 votes
  2. [2]
    Comment deleted by author
    Link
    1. timo
      Link Parent
      At one point do you feel the need for the const.py file? Maybe PyCharm can help you with that. You might write out const.my_new_const and let PyCharm create it via a shortcut.

      At one point do you feel the need for the const.py file? Maybe PyCharm can help you with that. You might write out const.my_new_const and let PyCharm create it via a shortcut.

      2 votes
  3. [4]
    mercury
    Link
    Is it possible to import a python file that is present in a parent directory?

    Is it possible to import a python file that is present in a parent directory?

    4 votes
    1. [2]
      gpl
      Link Parent
      You’ll have to add the directory containing the file to your python path, either permanently in your .bashrc or at runtime in your imports.

      You’ll have to add the directory containing the file to your python path, either permanently in your .bashrc or at runtime in your imports.

      3 votes
      1. mercury
        Link Parent
        Yeah. I thought this must be a frequent enough task for python to support using '../' for module imports.

        Yeah. I thought this must be a frequent enough task for python to support using '../' for module imports.

        1 vote
    2. pocketry
      Link Parent
      I've been struggling with this a lot recently too. I think my fault is that I run all my python scripts as individual files. That means, I'm not really using the module concept of my parent...

      I've been struggling with this a lot recently too. I think my fault is that I run all my python scripts as individual files. That means, I'm not really using the module concept of my parent directory. I've been thinking about creating a main.py file in the root directory that transforms all my little scripts into commands for an internal CLI. This doesn't help my desire to reuse code in jupyter notebooks. We'll see if I ever get around to it though.

      2 votes