[Python] Metabase does not output newline

Discussão em 'Python' iniciado por Stack, Fevereiro 22, 2025.

  1. Stack

    Stack Membro Participativo

    I use Metabase version 0.53.2 as visualization tool. It connects to my MySQL database. I have table log, which has desc column of type longtext. There is Python program, which stores several lines into one record, and lines are separated with character \n ie print('\n'). The example stored to mentioned desc column would be some text1\nsome text2. I want Metabase to printout that record in two lines like:

    some text1
    some text2


    Instead, it is printed out like some text1 some text2. I have created standard question in Metabase with SQL query like select * from log; but it seems it does not recognize \n character as new line.

    What else I have tried:

    • to change the SQL query hoping the Metabase will recognize HTML notation like select REPLACE(desc, char(10), '<br>') AS desc_formatted from log; but it does not recognize HTML and both lines get printed out again like some text1 some text2
    • to add \n like select REPLACE(desc, char(10), '\n') AS desc_formatted from log; but desires result not achieved
    • to add additional \n like select REPLACE(desc, char(10), '\n\n') AS desc_formatted from log; but desires result not achieved

    Does anybody happen to have any idea how to implement that in Metabase to achieve newline characters will be printed out and will be visible?

    Continue reading...

Compartilhe esta Página