adds CockroachDB as an option to the Piccolo playground - #1229
Conversation
| "litestar": ["litestar"], | ||
| "esmerald": ["esmerald"], | ||
| "lilya": ["lilya"], | ||
| "lilya": ["lilya", "orjson"], |
There was a problem hiding this comment.
Interesting that lilya would do this without having it as one of their own dependencies, but I'm OK with adding this if it works. 👍
There was a problem hiding this comment.
I agree with you that Lilya should have its own dependencies, because even lilya[all] (install everything) doesn't work. We should leave this as is to satisfy our integration tests.
There was a problem hiding this comment.
Reverted this because Lilya now uses standard library json and no longer orjson.
| "database": database, | ||
| "user": "root", | ||
| "password": "", | ||
| "port": 26257, |
There was a problem hiding this comment.
Port is kind of problematic, because we do allow the user to pass it in as an arg. I think we need to make port a nullable argument, which defaults to None. And if not passed in, then it's 5432 for Postgres and 26257 for Cockroach.
There was a problem hiding this comment.
I thought the default Cockroach port was enough (in playground we run CockroachDB in single node with the insecure flag and that is highlighted in the docs) because playground is only for testing or learning Piccolo. Do you think it could be port optional with something like this or?
def run(
...
port: Optional[int] = None,
...
):
if engine.upper() == "POSTGRES":
db: Engine = PostgresEngine(
{
...
"port": port if port is not None else 5432,
}
)
elif engine.upper() == "COCKROACH":
db = CockroachEngine(
{
...
"port": port if port is not None else 26257,
}
)There was a problem hiding this comment.
Yes, I think we should give the user the option to specify the port. So like you've done, except we can simplify it:
def run(
...
port: Optional[int] = None,
...
):
if engine.upper() == "POSTGRES":
db: Engine = PostgresEngine(
{
...
"port": port or 5432,
}
)
elif engine.upper() == "COCKROACH":
db = CockroachEngine(
{
...
"port": port or 26257,
}
)There was a problem hiding this comment.
Ok, I'll change that. Thanks.
| "host": host, | ||
| "database": database, | ||
| "user": "root", | ||
| "password": "", |
There was a problem hiding this comment.
We have a password param too, so we might need to do the same as with port - make it optional, and if not specified then default to an empty string?
Or in the docs tell them to create the database with the same password as Postgres (piccolo).
| :param user: | ||
| Postgres user |
There was a problem hiding this comment.
We need to update these params - e.g. Postgres/CockroachDB user.
Or Database user (ignored for SQLite)?
|
Tested it, and it works great 👍 Will merge in once CI finishes. |
Related to #1228. Also add
orjsonto theLilyaasgi template as it seems thatorjsonis now a hard dependency forLilya(without that change our integration test would fail for Lilya withModuleNotFoundError: No module named 'orjson').