Comments (15)
@viczam please take a look here:
http://senecajs.org/tutorials/understanding-data-entities.html
There you can see explanations about using multiple zones for your entities.
Let me know if it is OK by closing this, or add a comment.
from seneca-postgres-store.
uhm, not really.. I don't want to specify a zone, but a postgresql schema, as a I have my tables nested under a schema.
When parsing the canon, seneca accepts only words for zone / base / name, but you can schema a name like this:
seneca.make({
entity$: {
name: `${schema}.${table}`
}
}).canon$({array: true})
But the table name is escaped later on, so that won't work either.
from seneca-postgres-store.
is there a way to specify a connection string when setting up the seneca plugin, instead of the existing object?
from seneca-postgres-store.
You can specify also default schema for user:
ALTER USER user_name SET search_path to 'schema';
or when using multiple schema:
SET search_path TO myschema,public;
from seneca-postgres-store.
You can specify a connection string of the form:
postgres://username:password@localhost/database
from seneca-postgres-store.
I think this is a candidate for new feature, specify schema in connect object/url. I will open a feature issue.
from seneca-postgres-store.
how can I specify the connection string when setting up the plugin?
Probably I wasn't clear enough, but my issue is that I have a lot of tables nested under a schema and I want to make seneca entities for some of those tables and I can't find a way to do that. And that's because when calling saneca.make('SomeEntityThatCorrespondsToATable')
, it doesn't know it has to prefix the table with the schema name
from seneca-postgres-store.
Yes, for now there is not implemented the feature you need - first I misunderstood what you need. You can use a workaround like the one I described in my previous comment above for now by setting the default schema for connected user. In this case you do not need to use qualified table name.
I created a issue for this feature it will be added on next version.
from seneca-postgres-store.
A potential fix would be not to escape the table name in query_builder.js, or use a different strategy to allow schema definition as well.
If you do that, you can specify the entity definition this way:
seneca.make$({
entity$: {
name: `"${schema}"."${table}"`,
}
});
from seneca-postgres-store.
To match the Seneca store API and not add that "dot naming" that is not standard for us I think the best approach is to specify the schema in the connection object. Then you can use zones/base to select schema as usual for all stores.
I will take a look on that.
from seneca-postgres-store.
Sounds good, although you might have multiple schemas under the same database and you'll be forced to create different connections to the same database to target each schema in particular.
from seneca-postgres-store.
Yes, but this is the way Seneca stores are used to manage
tables/collections from different locations. It allows you to move very
easy schemes to a different database/machine or even different db engine.
malex
Pe 07.01.2016 17:53, "Victor Zamfir" [email protected] a scris:
Sounds good, although you might have multiple schemas under the same
database and you'll be forced to create different connections to the same
database to target each schema in particular.—
Reply to this email directly or view it on GitHub
#18 (comment)
.
from seneca-postgres-store.
Good point. Then allowing defining schema through the connection sounds like the best solutions.
from seneca-postgres-store.
@viczam I will let you know when this feature is published
from seneca-postgres-store.
Did this feature ever ship?
from seneca-postgres-store.
Related Issues (20)
- Deprecate postgres or postgresql plugin
- "when" column breaks the store
- Support for pool
- Some guide on using an entity with an auto generated 'id' field in the database
- native$ no longer passes `release` function HOT 3
- Audit packages
- Make a npm shrikwrap for requiresafe/CodeClimate HOT 1
- migration capabilities
- duplicated id column for fields$
- 2.0.0 Release notes
- Update seneca-store-test to 1.1.0 HOT 1
- Implement a backward compatibility sample HOT 1
- Add compatibility for seneca 2.0 HOT 1
- Possible leak detected HOT 1
- Document limit$ and skip$ at stores
- Query error when using reserved words as column names
- Update pg to 5.0.0 HOT 1
- Autoincrement
- undefined 'fromColumnName' HOT 2
- Safe mode : ensure param is not undefined
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 seneca-postgres-store.