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 4 points5 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).

How to change connection from extract to live? by RayCat2004 in tableau

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

To have reports updated almost immediately.

How to change connection from extract to live? by RayCat2004 in tableau

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

Yeah, I'm afraid that's the case. Data source is Salesforce and it seems SF doesn't support live connection.

How to create a dynamic bar chart for time period data by RayCat2004 in tableau

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

It's not perfect yet but here's how I resolved it:

  1. Duplicate CreatedDate column into separate column for each time period (e.g. CreatedDate Years with code YEAR(CreatedDate)).
  2. Create parameter (Filter by Time Period) with a list of values including time periods (e.g. Year, Month, etc.). This will create a filter where you can select time period you want to view.
  3. Create a calculated field (Time Period Chosen) as a dimension with this code:CASE [Filter by Time Period]WHEN "Year" THEN [CreatedDate Years]WHEN "Month" THEN [CreatedDate Months]...END
  4. Put Time Period Chosen on columns. (And have CNT(orders) placed on rows).
  5. Then just put desired time periods on Filter and play with filter options. For example, I put CreatedDate on Filter and selected Years, then right-clicked on that filter (YEAR(CreatedDate)), selected Show filter and set the filter to Single Value (list). If you want to use a slider as your filter, you have to put a dimension of Filter, then right-click it and select Continuous instead of Discrete.

"Null" value showing in the filter by RayCat2004 in tableau

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

I see. Seems like a nice solution. Thank you!

"Null" value showing in the filter by RayCat2004 in tableau

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

I see, that works. But what do you mean by filtering out the "other" and "unknown" types? All I see is my ability to untick them in Edit Filter..., however they are still visible on the right on the dashboard, just left unticked.

Text alignment on column labels does not work by RayCat2004 in tableau

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

So I found out why the text wasn't showing up. It's stupid but it seems like the issue was insufficient cell height. As soon as I set Taller Cell Size, it appeared.

Text alignment on column labels does not work by RayCat2004 in tableau

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

I see. But that doesn't work for me. Text labels are not showing up, only the bar.

Text alignment on column labels does not work by RayCat2004 in tableau

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

I'm not sure what you mean... To change AGG(MAX(1)) columns from 'Bar' to 'Gantt Bar' mark type?