<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 11.00.9600.19597"></HEAD>
<BODY>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=570134920-14072020>Hi
All,</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=570134920-14072020></SPAN></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=570134920-14072020>I am
learning how to use the get feature of foreign data wrappers and successfully
connected to various ogr data sources using ogr_fdw on postgres 12 on an
ubuntu 16.04 server.</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=570134920-14072020></SPAN></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=570134920-14072020>I
wanted to use this to import a whole lot of data from XLSX files and was able to
get one table connected as below perfectly all good to go
...</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=570134920-14072020></SPAN></FONT> </DIV>
<DIV><FONT color=#800000 size=2 face=Arial><SPAN class=570134920-14072020>CREATE
SERVER cmein_xlsx<BR> FOREIGN DATA WRAPPER ogr_fdw<BR> OPTIONS
(<BR> datasource
'/var/xy/mapdata/source/geodata/xy1.xlsx',<BR>
format 'XLSX' );</SPAN></FONT></DIV>
<DIV><FONT color=#800000 size=2 face=Arial><SPAN
class=570134920-14072020></SPAN></FONT> </DIV>
<DIV><FONT color=#800000 size=2 face=Arial><SPAN class=570134920-14072020>IMPORT
FOREIGN SCHEMA ogr_all<BR> LIMIT TO("Raw Data")<BR>FROM SERVER
cmein_xlsx INTO public<BR>OPTIONS(launder_table_names 'false',
launder_column_names 'true');</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=570134920-14072020></SPAN></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=570134920-14072020>However I read that (at least with shape files) it is
possible to alternatively to connect to a directory (and such to all shape file
inside) by setting the data source to that path. So for my XLSX files I tried as
below:</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=570134920-14072020></SPAN></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=570134920-14072020><FONT
color=#800000>CREATE SERVER all_cmein_xlsx<BR> FOREIGN DATA WRAPPER
ogr_fdw<BR> OPTIONS (<BR>
datasource
''/var/xy/mapdata/source/geodata,<BR>
format 'XLSX',<BR> config_options
'CPL_DEBUG=ON' );</FONT> </SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=570134920-14072020></SPAN></FONT> </DIV>
<DIV><SPAN class=570134920-14072020><FONT size=2><FONT color=#000080
face=Arial>The directory ''/var/xy/mapdata/source/geodata is readable by the
postgres user ...</FONT></FONT></SPAN></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=570134920-14072020>But
the query above gives me the following error :</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN
class=570134920-14072020></SPAN></FONT> </DIV>
<DIV><FONT color=#000080 size=2 face=Arial><SPAN class=570134920-14072020>ERROR:
unable to connect to data source "/var/xy/mapdata/source/geodata" SQL state:
HV00N</SPAN></FONT></DIV>
<DIV><FONT color=#000080 size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=570134920-14072020><FONT color=#000080 size=2 face=Arial>Is it
even possible to connect via ogr_fdw to a directory of multiple XLSX files
like that </FONT></SPAN></DIV>
<DIV><SPAN class=570134920-14072020><FONT color=#000080 size=2 face=Arial>and if
so what am I missing to make it work ?</FONT></SPAN></DIV>
<DIV><SPAN class=570134920-14072020><FONT color=#000080 size=2
face=Arial></FONT></SPAN> </DIV>
<DIV align=left>
<DIV><SPAN style="FONT-SIZE: 11pt; FONT-FAMILY: 'Verdana','sans-serif'"><FONT
color=#000080 size=2 face=Arial>Karsten</FONT> </SPAN></DIV></DIV></BODY></HTML>