Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
postgres_sql [2019/02/13 07:56]
root [Xml]
postgres_sql [2019/05/06 02:19] (current)
root [Foreign Data Wrapper]
Line 468: Line 468:
  
  
 +=== Copy - Bulk Loading with Python === 
 +
 +. With this code example we’re going to generate a CSV live though as opposed to reading one from disk. In production in both  Python you could parse the CSV out from disk, or generate it live from some other part of your pipeline like Kafka/​Kinesis.
 +
 +<code python>
 +conn = psycopg2.connect(DSN)
 +curs = conn.cursor()
 +
 +data = StringIO.StringIO()
 +data.write('​\n'​.join(['​1',​ '​2','​3'​]))
 +data.seek(0)
 +
 +curs.copy_from(data,​ '​my_table'​)
 +</​code>​
  
 == GIS == == GIS ==
Line 532: Line 546:
  
 https://​wiki.postgresql.org/​wiki/​PGQ_Tutorial https://​wiki.postgresql.org/​wiki/​PGQ_Tutorial
 +
 +== Logical Replication and  Streaming Replication == 
 +
 +
 +https://​www.postgresql.org/​docs/​current/​logical-replication.html
 +
 +<​code>​
 +CREATE PUBLICATION mypublication FOR TABLE users, departments;​
 +# Create a publication that publishes all changes in all tables:
 +
 +CREATE PUBLICATION alltables FOR ALL TABLES;
 +</​code> ​
 +
 +command. ​
 +
 +Streaming Replication (SR) provides the capability to continuously ship and apply the WAL XLOG records to some number of standby servers in order to keep them current.
 +
 +https://​wiki.postgresql.org/​wiki/​Streaming_Replication
 +
  
 == Foreign Data Wrapper ==  == Foreign Data Wrapper == 
Line 538: Line 571:
  
 https://​wiki.postgresql.org/​wiki/​Foreign_data_wrappers https://​wiki.postgresql.org/​wiki/​Foreign_data_wrappers
 +
 +=== Async Postgres - asyncpg ==
 +The developers of UvLoop applied it to the postgres binary protocol to claim 1m row inserts per seconds (faster than go)
 +
 +https://​magic.io/​blog/​asyncpg-1m-rows-from-postgres-to-python/​
 == Links and References ==  == Links and References == 
 * https://​github.com/​begriffs/​postgrest PostgREST serves a fully RESTful API from any existing PostgreSQL database. It provides a cleaner, more standards-compliant,​ faster API than you are likely to write from scratch. * https://​github.com/​begriffs/​postgrest PostgREST serves a fully RESTful API from any existing PostgreSQL database. It provides a cleaner, more standards-compliant,​ faster API than you are likely to write from scratch.
 * http://​www.postgresqltutorial.com/​ a list of tutorials of commands and methods ​ * http://​www.postgresqltutorial.com/​ a list of tutorials of commands and methods ​
  
 +* A good blog regarding features of modern sql https://​modern-sql.com/​blog/​2019-02/​postgresql-11
 Clients Clients
 * Web based client https://​github.com/​rickbergfalk/​sqlpad * Web based client https://​github.com/​rickbergfalk/​sqlpad
 
postgres_sql.1550073360.txt.gz · Last modified: 2019/02/13 07:56 by root
 
RSS - 200 © CrosswireDigitialMedia Ltd