Comments (10)
How are you starting PostGraphQL? Are you setting a specific schema?
from crystal.
@calebmer My databases are also all PostGIS enabled and got the same exception. PostGIS creates some views and tables in the public schema. I think the tables/views in question are those:
Schema | Name | Type | Owner
----------+-------------------+----------+-------
public | geography_columns | view | roman
public | geometry_columns | view | roman
public | raster_columns | view | roman
public | raster_overviews | view | roman
public | spatial_ref_sys | table | roman
Would be nice to exlude them somehow. Otherwise can't wait to try this out.
from crystal.
This is how I ran it node dist/main.js postgres://localhost:5432/seven --development
.
I was testing this on a database managed by django migrations which I guess puts everything in the public schema. In another database which doesn't use PostGIS everything worked correctly.
from crystal.
If you use the --schema
option you can specify the exact schema to use, otherwise PostGraphQL will default to the public
schema (and so all the PostGIS stuff 😊). So:
postgraphql postgres://localhost:5432 --schema my_schema --development
Does that work for you? I just added an example: here if you are curious.
from crystal.
I tried that, but it seems it put it all in the public schema.
from psql
:
*****=# \dn
List of schemas
Name | Owner
--------+-------
public | cp
(1 row)
from crystal.
Postgres queries have a schema lookup path; you can actually put the tables you care about for GraphQL in one schema and the postgis tables in another schema and queries will "fall back to" the secondary schema as long as you've set your search path. More generally, though, I think it would be helpful to be able to specify, somehow, an explicit list of tables to expose, or at the very least warn but not fail on tables without primary keys.
from crystal.
@myndzi agreed, the reason I require a primary key is to implement the Relay Node
interface, but on further thought, that constraint really isn't necessary. All tables don't need to be nodes.
from crystal.
@cmpis try:
create schema my_schema;
create table my_schema.my_table (…);
-- or to move a table:
alter table my_current_table set schema my_schema;
If you don't like prefixing all your tables with the schema name (my_table
) the example schema uses a schema lookup path like @myndzi recommends.
I'm removing the error for tables without primary keys now, but it is recommended to have all of your relevant tables in a single schema for PostGraphQL or else it will expose everything in the public schema.
from crystal.
Primary keys are no longer required as of #10/version 1.1.0. I'll wait for feedback and then close this issue.
Also, I've started a Gitter room if you want to talk about your experiences with PostGraphQL. Also, if you'd like to contribute I want to adopt an open-open source governance model so core collaborators have direct commit rights on the repo (only makes sense as PostGraphQL is definitely a critical dependency).
from crystal.
Closing as this fixed in 1.1.0 🎉
from crystal.
Related Issues (20)
- Add `tsvector` codec to the registry
- website: things to do before deployment HOT 1
- How to add condition for a table that is related to other(while joining tables) HOT 8
- Produce high-level telemetry
- Filtering of `listen()` HOT 2
- Document how to export the registry as executable and then build a schema from that in prod
- What is the recommended way to validate input?
- Postgraphile@v5 keeps failing in a docker container HOT 3
- How to query a key that has ":" in the dictionary HOT 5
- Development mode warning printed when in test mode HOT 2
- @omit tag does not get emulated correctly in v5
- Allow adding validation rules to Grafserv HOT 2
- Smart tag to shortcut accessing an attribute from a related table
- Current enum value isn't present on GraphQLEnumType_values_value scope HOT 2
- Planned module: @dataplan/graphql HOT 4
- Significant memory spike in plugin with each() HOT 3
- Grafast: garbage collection
- Grafast: hoisting of subroutines
- Exported PgCodec loses polymorphic information HOT 3
- `withPgClient` is intended for mutations - make it clear! HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crystal.