'How to store sql files in json format for python
I'm trying to use aws-lambdafunction to hit a database and extract some data, and drop it into an s3-bucket
I have multiple .sql files that I want to store the queries from the .sql files in a json file and make the database in python from the json files.
.sql file query:
SELECT item_id,
ite_invoice_id as invoice_id,
ite_sku as SKU,
ite_description as description,
ite_qty_shipped as quantity,
ite_unit_price as unit_price,
ite_extension as extension,
ite_pick_uom as unit_of_measure
FROM item
and then store it in a json file like this:
barney_queries = {
"acqut": "path/to/query_folder.item_sql"
}
for key, sql_query in aquisitions.barney_queries():
post_connection.cursor.execute(sql_query)
I'm not entirely sure if I got the structure down correctly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
