Skip to content

Commit 0874320

Browse files
committed
Merge branch 'main' of https://github.com/posit-dev/ggsql
2 parents 30301d4 + a37ca9c commit 0874320

2 files changed

Lines changed: 34 additions & 2 deletions

File tree

doc/gallery/examples/pie-chart.qmd

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,18 @@ VISUALISE island AS fill FROM ggsql:penguins
9898
PROJECT TO polar SETTING start => -90, end => 90
9999
SCALE angle SETTING expand => 0
100100
```
101+
102+
103+
### Faceting pie charts
104+
105+
When faceting, you will typically want to pies to be whole, which requires the `SETTING free => 'angle'` specification.
106+
107+
```{ggsql}
108+
VISUALISE island AS fill FROM ggsql:penguins
109+
DRAW bar
110+
PROJECT TO polar
111+
FACET species SETTING free => 'angle'
112+
```
113+
114+
115+

src/cli.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub enum Commands {
2929
/// The ggsql query to execute
3030
query: String,
3131

32-
/// Data source connection string (duckdb://, sqlite://)
32+
/// Data source connection string (duckdb://, sqlite://, odbc://)
3333
#[arg(long, default_value = "duckdb://memory")]
3434
reader: String,
3535

@@ -51,7 +51,7 @@ pub enum Commands {
5151
/// Path to .sql file containing ggsql query
5252
file: PathBuf,
5353

54-
/// Data source connection string (duckdb://, sqlite://)
54+
/// Data source connection string (duckdb://, sqlite://, odbc://)
5555
#[arg(long, default_value = "duckdb://memory")]
5656
reader: String,
5757

@@ -184,6 +184,23 @@ fn cmd_exec(query: String, reader: String, writer: String, output: Option<PathBu
184184
eprintln!("SQLite reader not compiled in. Rebuild with --features sqlite");
185185
std::process::exit(1);
186186
}
187+
} else if reader.starts_with("odbc://") {
188+
#[cfg(feature = "odbc")]
189+
{
190+
let r = match ggsql::reader::OdbcReader::from_connection_string(&reader) {
191+
Ok(r) => r,
192+
Err(e) => {
193+
eprintln!("Failed to create reader: {}", e);
194+
std::process::exit(1);
195+
}
196+
};
197+
exec_with_reader(&query, &r, &writer, output, verbose);
198+
}
199+
#[cfg(not(feature = "odbc"))]
200+
{
201+
eprintln!("ODBC reader not compiled in. Rebuild with --features odbc");
202+
std::process::exit(1);
203+
}
187204
} else if reader.starts_with("postgres://") || reader.starts_with("postgresql://") {
188205
eprintln!("PostgreSQL reader is not yet implemented");
189206
std::process::exit(1);

0 commit comments

Comments
 (0)