Read a sql table as a Pandas Dataframe

    0

    1

    Javier Pacheco

    The code reads a table from the file "table_name" and sets the "column" attribute to the first column of that table. The condition is a string that specifies the condition on which the table should be read.

    import pandas as pd
    
    df = pd.read_sql(
      "SELECT column "
      "FROM table_name "
      "WHERE condition "
      ,dbConnection
    )
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.