Share Improve this answer Follow answered at 5:07 Dimon Buzz 121 2 4 Thanks. Same will work if you just put cursor on any line in your statement without actually selecting it but only if your statements are separated with semicolon. In future articles, I’ll tackle some other operations such as updating tables, deleting tables, and working with tables within python scripts. You can select your query in pgAdmin sql window and press F5. Add the PostgreSQL bin directory path to the PATH environmental variable. After typing in your script, execute it by clicking the pgScript icon ( ). Now, the desired data will be located in a CSV on the file path that you specified! Next Steps. Download and install a PostgreSQL server. Launch pgScript by opening a regular SQL query window. This gets a little messy, but if you copy and paste this query into your query editor, it should be easier to read: COPY (SELECT CONCAT(addressnumber, ' ', streetdirection, ' ', streetname, ' ', stn_postyp, ' ', comm, ' ', state) as formatted_address FROM mailboxes) TO '/Users/brendanferris/Desktop/scripts/vehicle_analysis/output.csv' DELIMITER ',' CSV HEADER Here is the format: COPY () TO '' DELIMITER ',' CSV HEADER You can opt this option to execute multiple statement at once. (The above means that Im not aware any such plugins.) There is an option in PGAdmin called 'Execute PgScript' (yellow highlighted). In order to save these to their own CSV, we need to wrap the CONCAT query around the COPY keyword, specify the destination and name of the output file, as well as the delimiter. Not sure if this is OK for you, but you can open as many query windows as you want and so have as many result sets.
0 Comments
Leave a Reply. |