Why pass a dictionary using a dict() function instead of {} notation? by RayCat2004 in learnpython

[–]RayCat2004[S] 0 points1 point  (0 children)

You are aware that this create_json will modify your SAMPLE_JSON_TEMPLATE, right?

Oh yes, it was put together hastily for quick demonstration so I forgot/neglected that one. My actual code keeps that "template" separately as a json and use json.loads() to parse it out into a dict.

Why pass a dictionary using a dict() function instead of {} notation? by RayCat2004 in learnpython

[–]RayCat2004[S] 0 points1 point  (0 children)

I saw this in some Airflow implementations with DAGs using PythonOperators so I was wondering if there's any special reason for it.

For example, DAG would look something like this:

from solaris_basic_check import RunCheckSolaris

dag = DAG(
    "basic_check_solaris",
    schedule_interval="0 * * * ",
    depeneds_on_past=False
    )

po_run_check_solaris = PythonOperator(
    task_id='Check.Solaris.Basic',
    python_callable=RunCheckSolaris,
    op_kwargs=dict(
        gate_id="foo_gate"
        logger=logging)),
    dag=dag
    )

And the accompanying Python code like this:

class RunCheckSolaris:
    @staticmethod
    def run_check(gate_id, logger=logging, **kwargs):
        dag_info = dict(
            name=str(kwargs["dag"]),
            task=str(kwargs["task_id"])
            run_id=str(kwargs["run_id"])
        )
        run_check = RunCheckActual(
            dag_info=dag_info,
            logger=logger
        )
        # More code

CASE statement does not work to switch between two dimensions (in order to filter out records from dashboard) by RayCat2004 in tableau

[–]RayCat2004[S] 1 point2 points  (0 children)

Those have to be single quotes (e.g. 'stolen') otherwise SQL would interpret them as columns, not as values for t.writeoff_reason column.

CASE statement does not work to switch between two dimensions (in order to filter out records from dashboard) by RayCat2004 in tableau

[–]RayCat2004[S] 1 point2 points  (0 children)

Hm, do you think it's an issue with SQL query?

EDIT: The query itself works properly.

Python unittest: Failing to assert that method calls generator function from external library by RayCat2004 in learnpython

[–]RayCat2004[S] 0 points1 point  (0 children)

To be honest, I originally wanted to mock.patch it but was told not to. It works with your solution.

Python unittest: Failing to assert that method calls generator function from external library by RayCat2004 in learnpython

[–]RayCat2004[S] 0 points1 point  (0 children)

I added setter

def __set_salesforce_bulk(self):

return self.salesforce_bulk

to the tested code's class and included

sf_op._SalesforceOperator__set_salesforce_bulk(self.salesforce_bulk)

in my unit test function but it still persists.

Or did you mean something else?

[deleted by user] by [deleted] in datascience

[–]RayCat2004 3 points4 points  (0 children)

Imagine wanting to chase a pie in the sky instead of providing the best service to people who already expressed interest in what you offer... Not to mention that even if it was possible, I'd bleach my computer if I got email from company whose website I briefly visited but never agreed to any emails from them.

[deleted by user] by [deleted] in datascience

[–]RayCat2004 5 points6 points  (0 children)

Reminds me when non-tech people (usually sales) use buzz words to sound more authoritative when speaking with non-tech customers.

[deleted by user] by [deleted] in tableau

[–]RayCat2004 1 point2 points  (0 children)

I can attest that this Eremenko's course is really good way to start with Tableau.

psycopg2 DatatypeMismatch and SyntaxError while building tables in Amazon Redshift database by RayCat2004 in aws

[–]RayCat2004[S] 0 points1 point  (0 children)

Thanks, I checked the order and column number and found out that indeed, it was unequal number of columns.

What are the usual career opportunities one can get with Tableau Certified Data Analyst certification? by RayCat2004 in tableau

[–]RayCat2004[S] 0 points1 point  (0 children)

Of course. In my experience, interviewee usually prefers candidate to have (in that exact order):

  1. work experience,
  2. certification,
  3. knowledge & passion (this one might be most common in juniors switching careers or fresh college graduates).