| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
|
||
| self._class = value | ||
| self._connectionXML.set('dbclass', value) | ||
| self._connectionXML.set('class', value) |
There was a problem hiding this comment.
Totally a bug in my dbclass code.
Sorry, something went wrong.
|
Alright, I've totally got a prototype working for creating datasources (V10) as well. It's ugly but wanted to get it out for discussion. @classmethod
def from_scratch(cls, caption, connections):
from uuid import uuid4
unique = lambda x: x + '.' + str(uuid4()).replace('-', '')[:28]
root = ET.Element('datasource')
root.set('caption', caption)
root.set('version', '10.0')
outer_connection = ET.SubElement(root, 'connection')
outer_connection.set('class', 'federated')
named_conns = ET.SubElement(outer_connection, 'named-connections')
for conn in connections:
nc = ET.SubElement(named_conns, 'named-connection')
nc.set('name', unique(conn.dbclass))
nc.append(conn._connectionXML)
print(ET.tostring(root))
return cls(root)
I don't actually know the rules for what makes a good 'name' -- it appears to be dbclass + a 28 character random string ('postgres.1of3kl00aoax5d1a1ejma1397430'), it's definitely not a UUID though |
Sorry, something went wrong.
|
Alright, pushed my attempt. @RussTheAerialist I'm not sure if it's overcomplicating things or not, but it feels like this logic could live in an, bleck, DatasourceBuilder, or something like that. It could take in a version parameter and know how to build 9.X vs 10.X as well. Of course, none of that addresses the problem that these are 'bare' datasources without relations, metadata-records, or fields. Thoughts? |
Sorry, something went wrong.
|
|
||
|
|
||
| def make_unique_name(dbclass): | ||
| rand_part = ''.join(random.choice( |
There was a problem hiding this comment.
Our unique names are a hash based on the current time, so we should probably do that rather than random data. I can find the relevant code if you need it.
Sorry, something went wrong.
There was a problem hiding this comment.
Please!
Sorry, something went wrong.
|
🚀 this will need to be changed once I get all of the editor+physical+logical splitting done but for now, yay! |
Sorry, something went wrong.
|
Awesome! At least it'll let us play with some examples, and the tests will stay valid. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This is all that we'd need for creating connections from scratch.
Authentication isn't validated right now so it's not very safe, it defaults to '' because I need to research more how this attribute works
Feedback: