Skip to content

Commit 42f8cea

Browse files
cleaned up PR, updated readme (e.g. contribution guidelines)
1 parent 760d67d commit 42f8cea

File tree

6 files changed

+100
-82
lines changed

6 files changed

+100
-82
lines changed

.idea/libraries/ojdbc7.xml

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md renamed to README.MD

Lines changed: 80 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# SQL-dumper
22

3-
Command line tool, that dumps the result of SQL to an CSV on the filesystem. Queries can be using "extended SQL"
4-
split into subqueries, reducing the complexity on the server side.
3+
Command line tool, that dumps the result of SQL to an CSV on the filesystem.
4+
Queries can be using "extended SQL" split into subqueries, reducing the complexity
5+
on the server side.
56

6-
**Installation**:
7+
If you want to contribute, please see the [contribution guidelines](#contributing).
8+
9+
**Installation**:
710

811
Download [Oracle JDBC Driver 12c](http://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html) (tested with this version.) and put sql-dumper.jar and ojdbc7.jar in one folder. Note that the ojdbc7.jar file can not be gathered by maven, it has to be added manually to the project. To do so in IntelliJ IDEA, press <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>S</kbd>, go to "Libraries", and select the file from your local disc.
912

@@ -22,10 +25,10 @@ with the arguments being:
2225
The outputted CSV files will be saved to a sub directory of `outpath` following the convention `YYYY_MM_DD\` and be
2326
named after the SQL script file in the input directory (`myScript.SQL` will lead to a resultfile named `myScript.CSV`).
2427

25-
## extended SQL
28+
## Extended SQL
2629

27-
The following "extended SQL" commands are supported. Since being hidden as a comment (indicated by `--`, which is mandatory),
28-
the SQL files are still executable by every other SQL Tool (like the Oracle SQL Developer). Extended SQL is likely used
30+
The following "extended SQL" commands are supported. Since being hidden as a comment (indicated by `--`, which is mandatory),
31+
the SQL files are still executable by every other SQL Tool (like the Oracle SQL Developer). Extended SQL is likely used
2932
in the `WHERE` clause of your SQL script.
3033

3134
All subquery results will be concatenated into a single, output CSV file.
@@ -38,10 +41,10 @@ Inserts the given text. This is necessary because extended SQL is hidden in comm
3841

3942
#### Example
4043

41-
The following code
44+
The following code
4245

4346
-- $ESQL_text("WHERE mw.WERT_CODE = 123")
44-
47+
4548
Will simply output the text `"WHERE mw.WERT_CODE = 123` to sql query.
4649

4750
### Generate subqueries by an array of strings (`$ESQL_textArray`)
@@ -54,7 +57,7 @@ queried at a time can be set explicitly.
5457
The following code
5558

5659
-- $ESQL_text("AND MY_COL IN ") $ESQL_textArray(2, "VALA", "VALB", "VALC", "VALD")
57-
60+
5861
Will result in two subqueries, with the first one having `AND MY_COL IN ('VALA', 'VALB')`.
5962

6063

@@ -67,8 +70,8 @@ Generates a subquery for the given numbers. Encapsulates multiple numbers into o
6770
The following code
6871

6972
-- $ESQL_text("AND MY_COL IN ") $ESQL_numArray(2, 117, 118, 119)
70-
71-
Will generate two subqueries from the given SQL file. The first one will contain `AND MY_COL IN (2, 117)` and the second
73+
74+
Will generate two subqueries from the given SQL file. The first one will contain `AND MY_COL IN (2, 117)` and the second
7275
one `AND MY_COL IN (118, 119)`.
7376

7477
### Generate subquery for every number in range (`$ESQL_spreadNum`)
@@ -80,7 +83,7 @@ Generates a subquery for every number in the given range.
8083
The following code
8184

8285
-- $ESQL_text("AND MY_COL = ") $ESQL_spreadNum(1:100)
83-
86+
8487
Will generate 100 subqueries, the first one having the line `AND MY_COL = 1`. The last one will be `AND MY_COL = 100`.
8588

8689

@@ -93,7 +96,7 @@ Generates a given number of subqueries by slicing the given range into ranges of
9396
The following code
9497

9598
-- $ESQL_text("AND MY_COL ") $ESQL_spreadNumArea(1:100:10)
96-
99+
97100
Will generate 10 subqueries, with the first one being `AND MY_COL BETWEEN 1 AND 9`.
98101

99102
## Caveats / TODO
@@ -103,21 +106,78 @@ Will generate 10 subqueries, with the first one being `AND MY_COL BETWEEN 1 AND
103106
Feel free to contribute and support your pull request :)
104107

105108
## History
109+
110+
v.0.0.4 (12.09.2018)
111+
- Merged Pull-Request from [vbhavsingh](https://github.com/vbhavsingh) to
112+
support larger files. Thanks!
113+
- Merged Pull-Reqeust from [rizwan-ishtiaq](https://github.com/rizwan-ishtiaq) to fix bug (`;`
114+
is only removed at the end of .SQL file). Thanks!
115+
- Added Pull-Request tutorial.
116+
- minor readme improvements.
117+
106118
v.0.0.3 (02.05.2017)
107119

108-
- dynamic linking of JDBC driver (ojdbc7.jar)
109-
- Minor Bugfixes in last iteration of NumArray and TextArray functions
120+
- dynamic linking of JDBC driver (ojdbc7.jar) to be conform with the Java
121+
liscense.
122+
- Minor Bugfixes in last iteration of `NumArray` and `TextArray` functions.
110123

111124
v.0.0.2 (30.11.2016)
112125

113-
- Improved performance using `statement.setFetchSize()` and improving string creation using a `StringBuilder`
114-
- Minor Bugfixes in last iteration of NumArray and TextArray functions
115-
- Added compiled binary to /bin folder
116-
- Documentation when calling the jar without parameters
126+
- Improved performance using `statement.setFetchSize()` and improving string creation using a `StringBuilder`.
127+
- Minor Bugfixes in last iteration of NumArray and TextArray functions.
128+
- Added compiled binary to /bin folder.
129+
- Documentation when calling the jar without parameters.
117130

118131
v.0.0.1 (23.11.2016)
119132

120-
- initial commit
133+
- initial commit.
134+
135+
## Contributing
136+
137+
Inspired by the workflow from [scikit-learn](http://scikit-learn.org/stable/developers/contributing.html) these
138+
are the steps you need to follow for your Pull-Request to merged:
139+
140+
The preferred workflow for contributing to SQL-dumper is to fork the
141+
[main repository](https://github.com/scikit-learn/scikit-learn) on
142+
GitHub, clone, and develop on a branch. Steps:
143+
144+
1. Fork the [project repository](https://github.com/BernhardSchlegel/sql-dumper)
145+
by clicking on the "Fork" button near the top right of the page. This creates
146+
a copy of the code under your GitHub user account. For more details on
147+
how to fork a repository see [this guide](https://help.github.com/articles/fork-a-repo/).
148+
149+
2. Clone your fork of the SQL-dumper repo from your GitHub account to your local disk:
150+
151+
```bash
152+
$ git clone https://github.com/BernhardSchlegel/SQL-dumper.git
153+
$ cd SQL-dumper
154+
```
155+
156+
3. Create a ``feature`` branch to hold your development changes:
157+
158+
```bash
159+
$ git checkout -b my-feature
160+
```
161+
162+
Always use a ``feature`` branch. It's good practice to never work on the ``master`` branch!
163+
164+
4. Develop the feature on your feature branch. Add changed files using ``git add`` and then ``git commit`` files:
165+
166+
```bash
167+
$ git add modified_files
168+
$ git commit
169+
```
170+
171+
to record your changes in Git, then push the changes to your GitHub account with:
172+
173+
```bash
174+
$ git push -u origin my-feature
175+
```
176+
177+
5. Follow [these instructions](https://help.github.com/articles/creating-a-pull-request-from-a-fork)
178+
to create a pull request from your fork.
179+
180+
Thank you for your support !
121181

122182
## License: The MIT License (MIT)
123183

bin/sql-dumper.jar

-3.58 MB
Binary file not shown.

pom.xml

Lines changed: 9 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<modelVersion>4.0.0</modelVersion>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
46

5-
<groupId>de.bernhard-schlegel</groupId>
6-
<artifactId>sql_dumper</artifactId>
7-
<version>0.0.3</version>
7+
<groupId>de.bernhard-schlegel</groupId>
8+
<artifactId>sql_dumper</artifactId>
9+
<version>0.0.3</version>
810

9-
<dependencies>
10-
<dependency>
11-
<groupId>com.github.noraui</groupId>
12-
<artifactId>ojdbc7</artifactId>
13-
<version>12.1.0.2</version>
14-
</dependency>
15-
</dependencies>
16-
17-
<build>
18-
<plugins>
19-
<plugin>
20-
<groupId>org.apache.maven.plugins</groupId>
21-
<artifactId>maven-jar-plugin</artifactId>
22-
<configuration>
23-
<archive>
24-
<manifest>
25-
<mainClass>sqldump.Main</mainClass>
26-
</manifest>
27-
<manifestEntries>
28-
</manifestEntries>
29-
</archive>
30-
</configuration>
31-
</plugin>
32-
33-
<plugin>
34-
<groupId>org.apache.maven.plugins</groupId>
35-
<artifactId>maven-shade-plugin</artifactId>
36-
<version>2.4.3</version>
37-
<executions>
38-
<execution>
39-
<phase>package</phase>
40-
<goals>
41-
<goal>shade</goal>
42-
</goals>
43-
</execution>
44-
</executions>
45-
<configuration>
46-
<finalName>sql-dumper</finalName>
47-
<filters>
48-
<filter>
49-
<artifact>*:*</artifact>
50-
<excludes>
51-
<exclude>META-INF/*.SF</exclude>
52-
<exclude>META-INF/*.DSA</exclude>
53-
<exclude>META-INF/*.RSA</exclude>
54-
</excludes>
55-
</filter>
56-
</filters>
57-
</configuration>
58-
</plugin>
59-
</plugins>
60-
</build>
11+
<dependencies>
12+
</dependencies>
6113
</project>

sql_dumper.iml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
2+
<module type="JAVA_MODULE" version="4">
33
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5">
44
<output url="file://$MODULE_DIR$/target/classes" />
55
<output-test url="file://$MODULE_DIR$/target/test-classes" />
@@ -12,5 +12,6 @@
1212
<orderEntry type="inheritedJdk" />
1313
<orderEntry type="sourceFolder" forTests="false" />
1414
<orderEntry type="library" exported="" scope="PROVIDED" name="ojdbc7" level="project" />
15+
<orderEntry type="library" name="ojdbc71" level="project" />
1516
</component>
1617
</module>

0 commit comments

Comments
 (0)