I found the answer to my problem. The pgadmin3 tool won't let you specify both a server and a database. The server itself HAS a default database and when you select it with the --server
option, it won't let you pick a database. An error message would have been nice!
The 'defiant' server I made has in itself a default connection to a database, you have to set that default database, and you can't use commandline options to change it.
First, you must be disconnected from the default connection to the server you want to edit. Either make a new connection to a server or edit your existing one by right clicking your server, mine is: defiant(localhost:5432)
.
Then right click it, go to properties, you'll see a field called `maintenance DB', make that the connection to the database you want to be the default for this server connection. I set mine to kurz_prod. Click OK and restart.
Then the following command works. It opens pgadmin3, it gets a connection to the server and database that I specify, it opens a query window, it loads a previous file I specify into it. And immediately I can run statements against it.
This command is correct in opening an sql file with a connection to a server and database:
pgadmin3 --file=/home/el/Desktop/sqlfile_for_postgresql.sql --query --server=defiant
there are command line tools that do field type inferencing.
One is xsv https://github.com/BurntSushi/xsv/
Running this command on this (https://gist.githubusercontent.com/aborruso/3b1af402f0d2ed49465f218d19be81d9/raw/c0e95b320924e9e49902633d16e7ab253046ca16/input.csv)
xsv stats input.csv --everything | xsv table
you have
field type sum min max min_length max_length mean stddev median mode cardinality
id Integer 5050 1 100 1 3 50.5 28.86607004772212 50.5 N/A 100
first_name Unicode Annabal Willabella 3 11 N/A 98
last_name Unicode Albinson Zaniolini 3 13 N/A 100
f Float 2063.2419999999984 0.2656 51.1245 4 7 20.632419999999996 12.603955889545158 17.930799999999998 N/A 100
Using csvkit (https://csvkit.readthedocs.io/en/latest/index.html) and running
csvstat --csv input.csv
you will have
column_id column_name type nulls unique min max sum mean median stdev len freq
1 id Number False 100 1 100 5,050 50.5 50.5 29.011 - 1, 2, 3, 4, 5
2 first_name Text False 98 - - - - - - 11 Caren, Weylin, Heall, Flori, Lydia
3 last_name Text False 100 - - - - - - 13 Saxby, Joderli, Kleinzweig, Coyle, Kleinplac
4 f Number False 100 0.266 51.124 2,063.242 20.632 17.931 12.667 - 5.356, 12.596, 32.1245, 5.32, 0.2656
In csvkit you have also
csvsql -i postgresql input.csv
that gives you
CREATE TABLE input (
id DECIMAL NOT NULL,
first_name VARCHAR NOT NULL,
last_name VARCHAR NOT NULL,
f DECIMAL NOT NULL
);
Best Answer
It works if you deactivate the default MacOS shortcut for switching the input sources (keyboard layouts)