Comments (2)
Hi @RobertLowe, despite your explanation I would still bet in creating views is a better solution. You can easily automate the view creation using a bit of pl/pgsql like:
DO $$DECLARE sql text; r record;
BEGIN
FOR r IN SELECT table_catalog, table_schema, table_name FROM information_schema.tables
WHERE table_catalog = 'postgres' AND table_type = 'BASE TABLE' AND table_schema = 'public'
LOOP
sql := 'CREATE OR REPLACE VIEW view_schema.' || quote_ident(r.table_name) || ' AS SELECT ' || (
SELECT string_agg(quote_ident(c.column_name) || ' AS ' || quote_ident(CASE WHEN c.column_name LIKE '%\__'
THEN substr(c.column_name, 1, length(c.column_name) - 2)
ELSE c.column_name END), ',')
FROM information_schema.columns c
WHERE c.table_catalog = r.table_catalog
AND c.table_schema = r.table_schema
AND c.table_name = r.table_name
) || ' FROM ' || quote_ident(r.table_schema) || '.' || quote_ident(r.table_name);
RAISE NOTICE '%', sql;
EXECUTE sql;
END LOOP;
END$$;
If you want to touch ToroDB Stampede you should have a look on how it generated fields names in the d2r part of the engine. The problem is that if you have collisions in same column name with different type you will need to create a logic to hadle that (currently the code is highly coupled with the assumtion that the identifier will de unique). You can start looking at classes in https://github.com/torodb/engine/blob/master/core/src/main/java/com/torodb/core/d2r and in particular in the class DefaultIdentifierFactory.java
from stampede.
Awesome, thanks!
from stampede.
Related Issues (20)
- Include/Exclude Filtering Not excluding field HOT 2
- Make Stampede work without the __system role as Mongodb hosted on Mongo Atlas doesn't allow __system role HOT 1
- Oplog replication stream finished exceptionally: null HOT 8
- Extract nested field as an attribute not a relation HOT 1
- DBRefs are transformed into "_e" columns (embedded objects) HOT 2
- ToroDB Stampede gives no output HOT 1
- ToroDB shuts down unexpectedly HOT 2
- Issue in initial set up HOT 4
- Reason to use __system role in mongoDB. HOT 3
- Incompatile with mongodb version 3.6 ? HOT 4
- Fatal error while trying to refresh the metadata after an erroneuous attempt to prepare the schema HOT 2
- How i can prevent torodb to create duplicate columns on the basis of the datatype of the values in that column. HOT 1
- Using mysql backend incorrectly calling backend-common jar file HOT 3
- When will mongo 3.6 be supported? HOT 11
- Thinking of using stampede for ETL HOT 2
- unexpected field writeConcerMajorityJournalDefault in replica set configuration HOT 4
- Unable to build on os x - 10.15.7 HOT 1
- Is this project still active? HOT 2
- Alternative to stampede HOT 1
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 stampede.