cloudspannerecosystem / pgadapter Goto Github PK
View Code? Open in Web Editor NEWA proxy that translates the wire protocol from Postgres to Cloud Spanner.
License: Apache License 2.0
A proxy that translates the wire protocol from Postgres to Cloud Spanner.
License: Apache License 2.0
If ADC is available, the proxy shouldn't require a credential file. This is both useful on GCE and GKE given credentials are already available and on development machines.
I tried -j
option
replace.json
{
"commands":
[
{
"input_pattern": "^SELECT version();$",
"output_pattern": "PostgreSQL 9.6.17 on x86_64-pc-linux-gnu, compiled by gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516, 64-bit",
"matcher_array": []
}
]
}
exec query by psql
command.
example-db=> SELECT version();
ERROR: INVALID_ARGUMENT: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Function not found: version [at 1:8]
SELECT version();
It seems that the query is sent as it is to the spanner.
I just try this.
But failed tests.
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.google.cloud.spanner.pgadapter.MetadataTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.478 s - in com.google.cloud.spanner.pgadapter.MetadataTest
[INFO] Running com.google.cloud.spanner.pgadapter.ProtocolTest
[MockitoHint] ProtocolTest.testParseMessageWorksIfNameIsEmpty (see javadoc for MockitoHint):
[MockitoHint] 1. Unused -> at com.google.cloud.spanner.pgadapter.ProtocolTest.testParseMessageWorksIfNameIsEmpty(ProtocolTest.java:327)
[INFO] Tests run: 23, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.72 s - in com.google.cloud.spanner.pgadapter.ProtocolTest
[INFO] Running com.google.cloud.spanner.pgadapter.ConverterTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in com.google.cloud.spanner.pgadapter.ConverterTest
[INFO] Running com.google.cloud.spanner.pgadapter.StatementTest
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.222 s - in com.google.cloud.spanner.pgadapter.StatementTest
[INFO] Running com.google.cloud.spanner.pgadapter.PSQLTest
[MockitoHint] PSQLTest.testEscapes (see javadoc for MockitoHint):
[MockitoHint] 1. Unused -> at com.google.cloud.spanner.pgadapter.PSQLTest.setup(PSQLTest.java:65)
[MockitoHint] 2. Unused -> at com.google.cloud.spanner.pgadapter.PSQLTest.setup(PSQLTest.java:66)
[MockitoHint] 3. Unused -> at com.google.cloud.spanner.pgadapter.PSQLTest.setup(PSQLTest.java:67)
[MockitoHint] 4. Unused -> at com.google.cloud.spanner.pgadapter.PSQLTest.setup(PSQLTest.java:68)
[MockitoHint] 5. Unused -> at com.google.cloud.spanner.pgadapter.PSQLTest.setup(PSQLTest.java:71)
[INFO] Tests run: 30, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.173 s - in com.google.cloud.spanner.pgadapter.PSQLTest
[INFO] Running com.google.cloud.spanner.pgadapter.ParserTest
[ERROR] Tests run: 16, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.026 s <<< FAILURE! - in com.google.cloud.spanner.pgadapter.ParserTest
[ERROR] testTimestampParsing(com.google.cloud.spanner.pgadapter.ParserTest) Time elapsed: 0.008 s <<< FAILURE!
java.lang.AssertionError:
Expected: is [<49>, <57>, <57>, <56>, <45>, <48>, <57>, <45>, <48>, <52>, <32>, <48>, <56>, <58>, <48>, <48>, <58>, <48>, <48>, <46>, <48>]
but: was [<49>, <57>, <57>, <56>, <45>, <48>, <57>, <45>, <48>, <52>, <32>, <50>, <49>, <58>, <48>, <48>, <58>, <48>, <48>, <46>, <48>]
at com.google.cloud.spanner.pgadapter.ParserTest.validate(ParserTest.java:63)
at com.google.cloud.spanner.pgadapter.ParserTest.testTimestampParsing(ParserTest.java:191)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] ParserTest.testTimestampParsing:191->validate:63
Expected: is [<49>, <57>, <57>, <56>, <45>, <48>, <57>, <45>, <48>, <52>, <32>, <48>, <56>, <58>, <48>, <48>, <58>, <48>, <48>, <46>, <48>]
but: was [<49>, <57>, <57>, <56>, <45>, <48>, <57>, <45>, <48>, <52>, <32>, <50>, <49>, <58>, <48>, <48>, <58>, <48>, <48>, <46>, <48>]
[INFO]
[ERROR] Tests run: 82, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.518 s
[INFO] Finished at: 2020-04-10T20:54:35+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project google-cloud-spanner-pgadapter: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/hirocaster/src/github.com/cloudspannerecosystem/pgadapter/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
See the test output:
$ mvn package
...
[INFO] Tests run: 30, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.121 s - in com.google.cloud.spanner.pgadapter.PSQLTest
[INFO] Running com.google.cloud.spanner.pgadapter.ParserTest
[ERROR] Tests run: 17, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.027 s <<< FAILURE! - in com.google.cloud.spanner.pgadapter.ParserTest
[ERROR] testTimestampParsingStringPart(com.google.cloud.spanner.pgadapter.ParserTest) Time elapsed: 0.011 s <<< FAILURE!
java.lang.AssertionError:
Expected: is [<49>, <57>, <57>, <56>, <45>, <48>, <57>, <45>, <48>, <52>, <32>, <48>, <56>, <58>, <48>, <48>, <58>, <48>, <48>, <46>, <48>]
but: was [<49>, <57>, <57>, <56>, <45>, <48>, <57>, <45>, <48>, <52>, <32>, <48>, <50>, <58>, <48>, <48>, <58>, <48>, <48>, <46>, <48>]
at com.google.cloud.spanner.pgadapter.ParserTest.testTimestampParsingStringPart(ParserTest.java:200)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] ParserTest.testTimestampParsingStringPart:200
Expected: is [<49>, <57>, <57>, <56>, <45>, <48>, <57>, <45>, <48>, <52>, <32>, <48>, <56>, <58>, <48>, <48>, <58>, <48>, <48>, <46>, <48>]
but: was [<49>, <57>, <57>, <56>, <45>, <48>, <57>, <45>, <48>, <52>, <32>, <48>, <50>, <58>, <48>, <48>, <58>, <48>, <48>, <46>, <48>]
[INFO]
[ERROR] Tests run: 83, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.249 s
[INFO] Finished at: 2020-07-07T18:46:55-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project google-cloud-spanner-pgadapter: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/jbd/pgadapter/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Port numbers are wrongly formatted in the logs:
Jul 07, 2020 6:55:12 PM com.google.cloud.spanner.pgadapter.ProxyServer startServer
INFO: Server is starting on port 5,432
Jul 07, 2020 6:55:12 PM com.google.cloud.spanner.pgadapter.ProxyServer startServer
INFO: Server started on port 5,432
It's confusing if users want to grep the port number from the logs.
When trying to connect with pgAdmin, connection attempt fails with:
ERROR: INVALID_ARGUMENT: Unknown statement: SET DateStyle=ISO; SET client_min_messages=notice; SELECT set_config('bytea_output','escape',false) FROM pg_settings WHERE name = 'bytea_output'; SET client_encoding='UNICODE'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.