Comments (4)
@andyatkinson thanks for pointing out. I've added a way to specify default schema via ENV here: pawurb/ruby-pg-extras@43f2d2b it's now out as 5.3.1
. Please confirm if it resolves the issue.
from rails-pg-extras.
Hi @pawurb Nice, that fixes it. Here's my sample app for the book with a PR related to this gem update, and then invocations of the commands with the updated gem version:
andyatkinson/rideshare#162
I had hoped I could add the ENV var to the .env
file and it would "just work", but that wasn't the case. I imagine that would need some more work? Setting the env var in the terminal though before I invoke the commands works fine.
This fixes it for diagnose
too, we can see the schema is included in the generated SQL queries. Here's an example:
SELECT
....
FROM pg_stat_user_indexes ui
....
AND schemaname = 'rideshare'
...
Thanks!
from rails-pg-extras.
Ooh, I found the ruby-pg-extras gem, and figured out I can pass args: {schema: "other_schema"}
to the various helpers.
RailsPgExtras.cache_hit(args: {schema: "other_schema"})
I'll create a PR for this for the docs.
from rails-pg-extras.
@pawurb @drnic Hello! For Rideshare, it uses a custom rideshare
schema. I see I can run this code that @drnic mentioned (and hat tip @DanielaBaron for noticing this), but is there a way to make this the default via an initializer option? I am digging into the initializer now but didn't immediately see how to set a schema. I did configure an ENV var for rails-pg-extras. Unfortunately even though the default schema for the PostgreSQL user I'm connecting as (which is rideshare
) wasn't used, and public
was still used. I've removed the public
schema from that application database following "Safe schema patterns" best practices.
Expected: The default schema for the PostgreSQL user is used. I've removed
Actual: Queries use the public
schema when running bin/rails pg_extras:cache_hit
regardless of user's default schema
bin/rails runner 'RailsPgExtras.table_cache_hit(args: { schema: "rideshare" })'
from rails-pg-extras.
Related Issues (20)
- cannot load such file -- colorize HOT 2
- Merge rails-pg-extras-web -> rails-pg-extras HOT 5
- PG::UndefinedFile: ERROR: could not open extensions control file HOT 3
- "ArgumentError: Unparseable filesize: 8192 bytes" HOT 1
- uninitialized constant RailsPgExtras::Web::QueriesController::ACTIONS HOT 2
- Psych::BadAlias: Unknown alias: default HOT 4
- Build in UI Dashboard HOT 5
- New version errors out - LoadError: cannot load such file -- rails_pg_extras HOT 2
- Multiple Databases HOT 1
- RailsPgExtras.diagnose taking too long and not finishing production. HOT 1
- ArgumentError: unknown keyword: :aliases HOT 2
- Allow to set "public dashboard" via configuration HOT 1
- Installing `pg_stat_statements` and rails' tasks HOT 3
- Documentation causes error HOT 1
- postgres durations should be humanized HOT 1
- Diagnose does not accept args options like elsewhere HOT 2
- ActiveRecord::StatementInvalid when pg_stat_statements is enabled HOT 2
- More ideas
- pg_extras:calls and pg_extras:outliers don't work HOT 2
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 rails-pg-extras.