Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 99124

pymysql reading \n characters. how can I stop \n characters being run in an .sql file?

$
0
0

Error:

pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual 
that corresponds to your MySQL server version for the right syntax to use near 'CREATE 
PROCEDURE 
`sp_listProducts` (\n    SELECT p.product_id\n             , p.pr' at line 3")

SQL:

CREATE PROCEDURE `sp_listProducts` ()
    SELECT p.product_id
         , p.product
         , u.unit
         , p.unit_quantity
         , p.unit_weight
         , p.pr_number
         , pj.project_code
         , sec.sector
         , p.supplier
         , p.packaging_info
         , loc.location                        AS project_location
         , p.comments
         , loc.location_id
         , p.product_price
         , p.price_currency
         , p.gik_number
         , p.gik_stock_id
         , p.gik_supplier_id                   AS supplier_id
         , gik.gik_supplier
         , IF(tr.in_stock > 0, tr.in_stock, 0) as in_stock
FROM tbl_product AS p
             # get all FK values for display
             LEFT JOIN tbl_unit AS u ON p.unit_id = u.unit_id
             LEFT JOIN tbl_project AS pj ON p.project_id = pj.project_id
             LEFT JOIN tbl_location AS loc ON pj.location_id = loc.location_id
             lEFT JOIN tbl_sector AS sec ON p.sector_id = sec.sector_id
             LEFT JOIN tbl_gik_supplier AS gik ON p.gik_supplier_id = gik.gik_supplier_id
             LEFT JOIN (
    SELECT product_id
             , SUM(IF(trans_type IN ('in', 'count-gain', 'wb-gain'), trans_quantity, 0))                                                as inflow
             , SUM(IF(trans_type IN ('out', 'count-loss', 'wb-loss'), trans_quantity, 0))                                               as outflow
             , SUM(IF(trans_type IN ('in', 'count-gain', 'wb-gain'), trans_quantity, 0)) - SUM(IF(trans_type IN ('out', 'count-loss', 'wb-loss'), trans_quantity, 0)) as in_stock
    FROM tbl_transaction
    WHERE deleted=0
    GROUP By product_id
) tr
                                 ON p.product_id = tr.product_id
ORDER BY p.product_id ASC;

I've tried changing the encoding to UTF-8 to no avail. I've also set the project settins.json "files.encoding": "utf8" in vscode; didn't work. How do I get rid of the "\n" characters being read?


Viewing all articles
Browse latest Browse all 99124

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>