SlideShare a Scribd company logo
1 of 17
Download to read offline
PostgreSQL
Foreign Data wrappers
Connectivity to multiple
data sources
05/06/2018 – V1.0 – Frédéric Bamiere
What are Foreign Data Wrappers ?
2
 External data sources look like local tables
 SQL databases :
 MySQL - MariaDB
 Oracle
 SQL Server
 And … PostgreSQL…
 NOSQL:
 CouchDB,
 Redis,
 MongoDB
 Files
 LDAP
 Web Services
Why FDW ?
3
 Let the database do the work
 Avoid ETL interfaces and file transfer
 Security
Source Dalibo : wiki.postgresql.org/images/7/7e/Conferences-write_a_foreign_data_wrapper_in_15_minutes-presentation.pdf
4
FDW picture
How FDW ?
5
Foreign database
Client’s foreign DB
PostgreSQL foreign data
wrapper for foreign DB
User/password
Server
Port
Database
Nothing on this side !
Wrapper object
definitions
How ?
6
 In 2003, a new specification called SQL/MED ("SQL Management of External Data")
was added to the SQL standard. It is a standardized way of handling access to remote
objects from SQL databases.
 Generic SQL Database Wrappers :
 ODBC : CartoDB, PostgreSQL Foreign-data Wrapper for ODBC
 JDBC: ?
 Specific SQL Database Wrappers :
 PostgreSQL : Native
 Oracle : Oracle_fdw
 MariaDB - MySQL : mysql_fdw
 SQL Server : tds_fdw
 Others :
 MongoDB : mongo_fdw
7
Install :
• The extension
mysql_fdw
• Mysql Client
10.2.9-MariaDB
https://github.com/EnterpriseDB/mysql_fdw
CREATE FOREIGN SERVER
8
-- To be executed as postgres on the meetup database
CREATE EXTENSION IF NOT EXISTS mysql_fdw;
DROP SCHEMA IF EXISTS mariadb_root;
CREATE SCHEMA mariadb_root;
grant all on schema mariadb_root to meetup_owner;
DROP SERVER IF EXISTS foreign_mariadb CASCADE;
CREATE SERVER foreign_mariadb
FOREIGN DATA WRAPPER mysql_fdw
OPTIONS (host 'dctpbdda02.int.tdc',
port '3306');
CREATE USER MAPPING FOR meetup_owner
SERVER foreign_mariadb
OPTIONS (username 'root', password 'new-password');
GRANT USAGE ON FOREIGN SERVER foreign_mariadb TO meetup_owner;
-- end of script
CREATE FOREIGN TABLE
9
-- To be executed as meetup_owner on the meetup database
DROP FOREIGN TABLE tiers;
--CREATE FOREIGN TABLE mariadb_root.tiers (
CREATE FOREIGN TABLE tiers (
idtiers int8,
type_tiers varchar(3),
numero_tiers varchar(20),
raison_sociale varchar(100),
user_creation varchar(20),
date_creation timestamp,
user_maj varchar(20),
date_maj timestamp,
idtraitement int8)
SERVER foreign_mariadb
OPTIONS (dbname 'dev_cdp_paiement', table_name 'tiers');
-- it is possible to define a subset of a table.
IMPORT FOREIGN SCHEMA
10
-- To be executed as meetup_owner on the meetup database
DROP FOREIGN TABLE tiers;
-- to be executed as meetup_owner
IMPORT FOREIGN SCHEMA "dev_cdp_paiement"
FROM SERVER foreign_mariadb
INTO mariadb_root;
11
Foreign database
PostgreSQL V10.4
12
Foreign database
Install :
• The extension oracle_fdw
• Oracle Client
V12.1
https://github.com/laurenz/oracle_fdw
Heterogeneous JOINS
13
Heterogeneous JOINS !!
14
Test your functionalities !
15
 All foreign data wrappers do no support same functionality
 Update
 Joins between foreign tables limitations (see each fdw documentation)
 Data types conversion
 Charset difference between source and target
 Example: MariaDB : Charset conversion error: Re creating meetup database in utf8 : it works !
 Null values
 INSERT/UPDATE/DELETE : It depends on the FDW capabilities
Documentation
16
https://pgxn.org/tag/foreign%20data%20wrapper/
Documentation
17

More Related Content

What's hot

Riak from Small to Large
Riak from Small to LargeRiak from Small to Large
Riak from Small to LargeRusty Klophaus
 
Lt html data_attributes
Lt html data_attributesLt html data_attributes
Lt html data_attributesYuzu Saijo
 
Accra MongoDB User Group
Accra MongoDB User GroupAccra MongoDB User Group
Accra MongoDB User GroupMongoDB
 
Introduction to CouchDB - LA Hacker News
Introduction to CouchDB - LA Hacker NewsIntroduction to CouchDB - LA Hacker News
Introduction to CouchDB - LA Hacker NewsMichael Parker
 
WP 2: overview of the progress of WP2 on the "CLARIAH-day 22-01-2016
WP 2: overview of the progress of WP2 on the "CLARIAH-day 22-01-2016 WP 2: overview of the progress of WP2 on the "CLARIAH-day 22-01-2016
WP 2: overview of the progress of WP2 on the "CLARIAH-day 22-01-2016 CLARIAH
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & IntroductionJerwin Roy
 
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011camp_drupal_ua
 
MySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x PresentationMySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x PresentationDave Stokes
 
Making MySQL Agile-ish
Making MySQL Agile-ishMaking MySQL Agile-ish
Making MySQL Agile-ishDave Stokes
 
Remote Blob Storage in SharePoint 2010
Remote Blob Storage in SharePoint 2010Remote Blob Storage in SharePoint 2010
Remote Blob Storage in SharePoint 2010Nathan DeWitt
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
MongoDB Europe 2016 - MongoDB 3.4 preview and introduction to MongoDB Atlas
MongoDB Europe 2016 - MongoDB 3.4 preview and introduction to MongoDB AtlasMongoDB Europe 2016 - MongoDB 3.4 preview and introduction to MongoDB Atlas
MongoDB Europe 2016 - MongoDB 3.4 preview and introduction to MongoDB AtlasMongoDB
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)Woonsan Ko
 
Mongo db – document oriented database
Mongo db – document oriented databaseMongo db – document oriented database
Mongo db – document oriented databaseWojciech Sznapka
 

What's hot (20)

Riak from Small to Large
Riak from Small to LargeRiak from Small to Large
Riak from Small to Large
 
Lt html data_attributes
Lt html data_attributesLt html data_attributes
Lt html data_attributes
 
Accra MongoDB User Group
Accra MongoDB User GroupAccra MongoDB User Group
Accra MongoDB User Group
 
Introduction to CouchDB - LA Hacker News
Introduction to CouchDB - LA Hacker NewsIntroduction to CouchDB - LA Hacker News
Introduction to CouchDB - LA Hacker News
 
WP 2: overview of the progress of WP2 on the "CLARIAH-day 22-01-2016
WP 2: overview of the progress of WP2 on the "CLARIAH-day 22-01-2016 WP 2: overview of the progress of WP2 on the "CLARIAH-day 22-01-2016
WP 2: overview of the progress of WP2 on the "CLARIAH-day 22-01-2016
 
Mongo db1
Mongo db1Mongo db1
Mongo db1
 
Introduction to mongo db
Introduction to mongo dbIntroduction to mongo db
Introduction to mongo db
 
MongoDB basics & Introduction
MongoDB basics & IntroductionMongoDB basics & Introduction
MongoDB basics & Introduction
 
Redis IU
Redis IURedis IU
Redis IU
 
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
 
MySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x PresentationMySQL Document Store -- SCaLE 17x Presentation
MySQL Document Store -- SCaLE 17x Presentation
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
Making MySQL Agile-ish
Making MySQL Agile-ishMaking MySQL Agile-ish
Making MySQL Agile-ish
 
Remote Blob Storage in SharePoint 2010
Remote Blob Storage in SharePoint 2010Remote Blob Storage in SharePoint 2010
Remote Blob Storage in SharePoint 2010
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
Mongo db
Mongo dbMongo db
Mongo db
 
MongoDB Europe 2016 - MongoDB 3.4 preview and introduction to MongoDB Atlas
MongoDB Europe 2016 - MongoDB 3.4 preview and introduction to MongoDB AtlasMongoDB Europe 2016 - MongoDB 3.4 preview and introduction to MongoDB Atlas
MongoDB Europe 2016 - MongoDB 3.4 preview and introduction to MongoDB Atlas
 
Relevance trilogy may dream be with you! (dec17)
Relevance trilogy  may dream be with you! (dec17)Relevance trilogy  may dream be with you! (dec17)
Relevance trilogy may dream be with you! (dec17)
 
Mongo db – document oriented database
Mongo db – document oriented databaseMongo db – document oriented database
Mongo db – document oriented database
 

Similar to 02 20180605 meetup_fdw_v1

Oracle sharding : Installation & Configuration
Oracle sharding : Installation & ConfigurationOracle sharding : Installation & Configuration
Oracle sharding : Installation & Configurationsuresh gandhi
 
MySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and DevelopersMySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and DevelopersRonald Bradford
 
Transparent sharding with Spider: what's new and getting started
Transparent sharding with Spider: what's new and getting startedTransparent sharding with Spider: what's new and getting started
Transparent sharding with Spider: what's new and getting startedMariaDB plc
 
SQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQLSQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQLPeter Eisentraut
 
Building Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDBBuilding Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDBAshnikbiz
 
Service discovery and configuration provisioning
Service discovery and configuration provisioningService discovery and configuration provisioning
Service discovery and configuration provisioningSource Ministry
 
DFDL and Apache Daffodil(tm) Overview from Owl Cyber Defense
DFDL and Apache Daffodil(tm) Overview from Owl Cyber DefenseDFDL and Apache Daffodil(tm) Overview from Owl Cyber Defense
DFDL and Apache Daffodil(tm) Overview from Owl Cyber DefenseMike Beckerle
 
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UK
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UKIntroduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UK
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UKSkills Matter
 
Nko workshop - node js & nosql
Nko workshop - node js & nosqlNko workshop - node js & nosql
Nko workshop - node js & nosqlSimon Su
 
Midgard2 - Content Repository for mobile applications
Midgard2 - Content Repository for mobile applicationsMidgard2 - Content Repository for mobile applications
Midgard2 - Content Repository for mobile applicationsHenri Bergius
 
Drupal MySQL Cluster
Drupal MySQL ClusterDrupal MySQL Cluster
Drupal MySQL ClusterKris Buytaert
 
A Tale of Three Apache Spark APIs: RDDs, DataFrames, and Datasets with Jules ...
A Tale of Three Apache Spark APIs: RDDs, DataFrames, and Datasets with Jules ...A Tale of Three Apache Spark APIs: RDDs, DataFrames, and Datasets with Jules ...
A Tale of Three Apache Spark APIs: RDDs, DataFrames, and Datasets with Jules ...Databricks
 
Spider Setup with AWS/sandbox
Spider Setup with AWS/sandboxSpider Setup with AWS/sandbox
Spider Setup with AWS/sandboxI Goo Lee
 
MySQL Spider Architecture
MySQL Spider ArchitectureMySQL Spider Architecture
MySQL Spider ArchitectureI Goo Lee
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introductionTse-Ching Ho
 
Introduction to Apache Spark
Introduction to Apache Spark Introduction to Apache Spark
Introduction to Apache Spark Hubert Fan Chiang
 
Improve PostgreSQL replication with Oracle GoldenGate
Improve PostgreSQL replication with Oracle GoldenGateImprove PostgreSQL replication with Oracle GoldenGate
Improve PostgreSQL replication with Oracle GoldenGateBobby Curtis
 

Similar to 02 20180605 meetup_fdw_v1 (20)

Distribuido
DistribuidoDistribuido
Distribuido
 
Oracle sharding : Installation & Configuration
Oracle sharding : Installation & ConfigurationOracle sharding : Installation & Configuration
Oracle sharding : Installation & Configuration
 
MySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and DevelopersMySQL For Oracle DBA's and Developers
MySQL For Oracle DBA's and Developers
 
Transparent sharding with Spider: what's new and getting started
Transparent sharding with Spider: what's new and getting startedTransparent sharding with Spider: what's new and getting started
Transparent sharding with Spider: what's new and getting started
 
SQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQLSQL/MED: Doping for PostgreSQL
SQL/MED: Doping for PostgreSQL
 
ivanova-samba_backend.pdf
ivanova-samba_backend.pdfivanova-samba_backend.pdf
ivanova-samba_backend.pdf
 
Building Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDBBuilding Hybrid data cluster using PostgreSQL and MongoDB
Building Hybrid data cluster using PostgreSQL and MongoDB
 
Service discovery and configuration provisioning
Service discovery and configuration provisioningService discovery and configuration provisioning
Service discovery and configuration provisioning
 
Drupal 7 database api
Drupal 7 database api Drupal 7 database api
Drupal 7 database api
 
DFDL and Apache Daffodil(tm) Overview from Owl Cyber Defense
DFDL and Apache Daffodil(tm) Overview from Owl Cyber DefenseDFDL and Apache Daffodil(tm) Overview from Owl Cyber Defense
DFDL and Apache Daffodil(tm) Overview from Owl Cyber Defense
 
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UK
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UKIntroduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UK
Introduction to Sqoop Aaron Kimball Cloudera Hadoop User Group UK
 
Nko workshop - node js & nosql
Nko workshop - node js & nosqlNko workshop - node js & nosql
Nko workshop - node js & nosql
 
Midgard2 - Content Repository for mobile applications
Midgard2 - Content Repository for mobile applicationsMidgard2 - Content Repository for mobile applications
Midgard2 - Content Repository for mobile applications
 
Drupal MySQL Cluster
Drupal MySQL ClusterDrupal MySQL Cluster
Drupal MySQL Cluster
 
A Tale of Three Apache Spark APIs: RDDs, DataFrames, and Datasets with Jules ...
A Tale of Three Apache Spark APIs: RDDs, DataFrames, and Datasets with Jules ...A Tale of Three Apache Spark APIs: RDDs, DataFrames, and Datasets with Jules ...
A Tale of Three Apache Spark APIs: RDDs, DataFrames, and Datasets with Jules ...
 
Spider Setup with AWS/sandbox
Spider Setup with AWS/sandboxSpider Setup with AWS/sandbox
Spider Setup with AWS/sandbox
 
MySQL Spider Architecture
MySQL Spider ArchitectureMySQL Spider Architecture
MySQL Spider Architecture
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introduction
 
Introduction to Apache Spark
Introduction to Apache Spark Introduction to Apache Spark
Introduction to Apache Spark
 
Improve PostgreSQL replication with Oracle GoldenGate
Improve PostgreSQL replication with Oracle GoldenGateImprove PostgreSQL replication with Oracle GoldenGate
Improve PostgreSQL replication with Oracle GoldenGate
 

Recently uploaded

Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 

02 20180605 meetup_fdw_v1

  • 1. PostgreSQL Foreign Data wrappers Connectivity to multiple data sources 05/06/2018 – V1.0 – Frédéric Bamiere
  • 2. What are Foreign Data Wrappers ? 2  External data sources look like local tables  SQL databases :  MySQL - MariaDB  Oracle  SQL Server  And … PostgreSQL…  NOSQL:  CouchDB,  Redis,  MongoDB  Files  LDAP  Web Services
  • 3. Why FDW ? 3  Let the database do the work  Avoid ETL interfaces and file transfer  Security
  • 4. Source Dalibo : wiki.postgresql.org/images/7/7e/Conferences-write_a_foreign_data_wrapper_in_15_minutes-presentation.pdf 4 FDW picture
  • 5. How FDW ? 5 Foreign database Client’s foreign DB PostgreSQL foreign data wrapper for foreign DB User/password Server Port Database Nothing on this side ! Wrapper object definitions
  • 6. How ? 6  In 2003, a new specification called SQL/MED ("SQL Management of External Data") was added to the SQL standard. It is a standardized way of handling access to remote objects from SQL databases.  Generic SQL Database Wrappers :  ODBC : CartoDB, PostgreSQL Foreign-data Wrapper for ODBC  JDBC: ?  Specific SQL Database Wrappers :  PostgreSQL : Native  Oracle : Oracle_fdw  MariaDB - MySQL : mysql_fdw  SQL Server : tds_fdw  Others :  MongoDB : mongo_fdw
  • 7. 7 Install : • The extension mysql_fdw • Mysql Client 10.2.9-MariaDB https://github.com/EnterpriseDB/mysql_fdw
  • 8. CREATE FOREIGN SERVER 8 -- To be executed as postgres on the meetup database CREATE EXTENSION IF NOT EXISTS mysql_fdw; DROP SCHEMA IF EXISTS mariadb_root; CREATE SCHEMA mariadb_root; grant all on schema mariadb_root to meetup_owner; DROP SERVER IF EXISTS foreign_mariadb CASCADE; CREATE SERVER foreign_mariadb FOREIGN DATA WRAPPER mysql_fdw OPTIONS (host 'dctpbdda02.int.tdc', port '3306'); CREATE USER MAPPING FOR meetup_owner SERVER foreign_mariadb OPTIONS (username 'root', password 'new-password'); GRANT USAGE ON FOREIGN SERVER foreign_mariadb TO meetup_owner; -- end of script
  • 9. CREATE FOREIGN TABLE 9 -- To be executed as meetup_owner on the meetup database DROP FOREIGN TABLE tiers; --CREATE FOREIGN TABLE mariadb_root.tiers ( CREATE FOREIGN TABLE tiers ( idtiers int8, type_tiers varchar(3), numero_tiers varchar(20), raison_sociale varchar(100), user_creation varchar(20), date_creation timestamp, user_maj varchar(20), date_maj timestamp, idtraitement int8) SERVER foreign_mariadb OPTIONS (dbname 'dev_cdp_paiement', table_name 'tiers'); -- it is possible to define a subset of a table.
  • 10. IMPORT FOREIGN SCHEMA 10 -- To be executed as meetup_owner on the meetup database DROP FOREIGN TABLE tiers; -- to be executed as meetup_owner IMPORT FOREIGN SCHEMA "dev_cdp_paiement" FROM SERVER foreign_mariadb INTO mariadb_root;
  • 12. 12 Foreign database Install : • The extension oracle_fdw • Oracle Client V12.1 https://github.com/laurenz/oracle_fdw
  • 15. Test your functionalities ! 15  All foreign data wrappers do no support same functionality  Update  Joins between foreign tables limitations (see each fdw documentation)  Data types conversion  Charset difference between source and target  Example: MariaDB : Charset conversion error: Re creating meetup database in utf8 : it works !  Null values  INSERT/UPDATE/DELETE : It depends on the FDW capabilities