-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pg_catalog.version(), standard_conforming_strings session var (#…
…2448) Adds the `pg_catalog.version()` function (which provides more info that the `server_version` session var). The format provides compatibility with sqlalchemy/great expectations. Also adds the `standard_conforming_strings` session var since great expectations was looking for this too. I included the python script I was running against to get great expectations working, and it seems to connect without issue. But I haven't tried anything more than that. cc @talagluck
- Loading branch information
Showing
14 changed files
with
148 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import great_expectations as gx | ||
|
||
context = gx.get_context() # gets a great expectations project context | ||
ds = context.sources.add_postgres( | ||
name="glaredb", | ||
connection_string="postgresql://sean:sean@localhost:6543/db", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,5 @@ pandas | |
polars | ||
pytest | ||
pandasai | ||
great_expectations[postgresql] | ||
great_expectations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ num-traits = "0.2.17" | |
dtoa = "1.0.9" | ||
chrono-tz = "0.8.5" | ||
bytes = "1.4.0" | ||
const_format = "0.2.32" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// Variables desribing the postgres version glaredb claims to be compatible with. | ||
use const_format::concatcp; | ||
|
||
pub const PG_MAJOR_VERSION: u16 = 15; | ||
pub const PG_MINOR_VERSION: u16 = 1; | ||
|
||
/// A short-form version string for use in the `server_version` session | ||
/// variable. | ||
pub const fn server_version() -> &'static str { | ||
concatcp!(PG_MAJOR_VERSION, ".", PG_MINOR_VERSION) | ||
} | ||
|
||
/// A long-form version string for use in the `pg_catalog.version()` function. | ||
/// | ||
/// Example: | ||
/// PostgreSQL 15.1 on aarch64-unknown-linux-gnu, compiled by rustc (GlareDB 0.8.1) | ||
pub const fn server_version_with_build_info() -> &'static str { | ||
// TODO: We should have a build_info crate with these constants. | ||
const GLAREDB_VERSION: &str = env!("CARGO_PKG_VERSION"); | ||
const TARGET_TRIPLE: &str = "aarch64-unknown-linux-gnu"; // Again, build_info crate. | ||
|
||
concatcp!( | ||
"PostgreSQL ", | ||
server_version(), | ||
" on ", | ||
TARGET_TRIPLE, | ||
", compiled by rustc (GlareDB ", | ||
GLAREDB_VERSION, | ||
")" | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod compatible; | ||
pub mod error; | ||
pub mod format; | ||
pub mod notice; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
query B | ||
query T | ||
select starts_with(version(), 'v') | ||
---- | ||
t | ||
|
||
# There also exists a stub for pg_catalog.version(). This is hard coded to a | ||
# postgres version maximize compatability with postgres tooling, and is | ||
# _different_ than the `version()` function. | ||
# | ||
# Needed for great expections: <https://github.com/GlareDB/glaredb/issues/2436#issuecomment-1899383224> | ||
query T | ||
select starts_with(pg_catalog.version(), 'PostgreSQL 15.1') | ||
---- | ||
t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters