]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
1 | #!/usr/bin/env bash |
2 | # | |
3 | # Licensed to the Apache Software Foundation (ASF) under one or more | |
4 | # contributor license agreements. See the NOTICE file distributed with | |
5 | # this work for additional information regarding copyright ownership. | |
6 | # The ASF licenses this file to You under the Apache License, Version 2.0 | |
7 | # (the "License"); you may not use this file except in compliance with | |
8 | # the License. You may obtain a copy of the License at | |
9 | # | |
10 | # http://www.apache.org/licenses/LICENSE-2.0 | |
11 | # | |
12 | # Unless required by applicable law or agreed to in writing, software | |
13 | # distributed under the License is distributed on an "AS IS" BASIS, | |
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | # See the License for the specific language governing permissions and | |
16 | # limitations under the License. | |
17 | # | |
18 | ||
19 | set -e | |
20 | DOTFILE=data_model.dot | |
21 | OUTFILE=data_model.rst | |
22 | ||
23 | license() { | |
24 | cat <<'LICENSE' > ${1} | |
25 | .. Licensed to the Apache Software Foundation (ASF) under one | |
26 | .. or more contributor license agreements. See the NOTICE file | |
27 | .. distributed with this work for additional information | |
28 | .. regarding copyright ownership. The ASF licenses this file | |
29 | .. to you under the Apache License, Version 2.0 (the | |
30 | .. "License"); you may not use this file except in compliance | |
31 | .. with the License. You may obtain a copy of the License at | |
32 | ||
33 | .. http://www.apache.org/licenses/LICENSE-2.0 | |
34 | ||
35 | .. Unless required by applicable law or agreed to in writing, | |
36 | .. software distributed under the License is distributed on an | |
37 | .. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
38 | .. KIND, either express or implied. See the License for the | |
39 | .. specific language governing permissions and limitations | |
40 | .. under the License. | |
41 | ||
42 | ||
43 | LICENSE | |
44 | } | |
45 | ||
46 | warning() { | |
47 | cat <<'WARNING' >> ${1} | |
48 | .. WARNING | |
49 | .. This is an auto-generated file. Please do not edit. | |
50 | ||
51 | .. To reproduce, please run :code:`./make_data_model_rst.sh`. | |
52 | .. (This requires you have the | |
53 | .. `psql client <https://www.postgresql.org/download/>`_ | |
54 | .. and have started the docker containers using | |
55 | .. :code:`docker-compose up`). | |
56 | ||
57 | WARNING | |
58 | } | |
59 | ||
60 | echo "Making ${OUTFILE}" | |
61 | ||
62 | license ${OUTFILE} | |
63 | warning ${OUTFILE} | |
64 | ||
65 | PGPASSWORD=arrow \ | |
66 | psql --tuples-only --username=arrow_web \ | |
67 | --dbname=benchmark --port=5432 --host=localhost \ | |
68 | --command="select public.documentation('${DOTFILE}');" \ | |
69 | | sed "s/ *+$//" | sed "s/^ //" >> ${OUTFILE} |